如何复制和粘贴带有不平衡引号的字符串?

How to copy and paste a string with imbalanced quotation marks?

考虑以下文本

Today is the day "Stack Overflow" will miss its year's target

如果我复制并粘贴此文本并尝试将其放入变量中,如下所示:

mystring = "Today is the day "Stack Overflow" will miss its year's target"

这将不起作用,因为引号不平衡。

有没有简单的解决办法?如何将此文本复制并粘贴到我的 R 脚本中?

发短信给警察y

Today is the day "Stack Overflow" will miss its year's target.
Yesterday is the day "Stack Overflow" will miss its year's target's sum.

读入R

x = readLines("clipboard")
#Warning message:
#In readLines("clipboard") : incomplete final line found on 'clipboard'

转换为data.frame

data.frame(x)                                                                             
#                                                                        x
#1           Today is the day "Stack Overflow" will miss its year's target.
#2 Yesterday is the day "Stack Overflow" will miss its year's target's sum.

而不是 "clipboard",您也可以将复制的文本粘贴到文件中并使用 readLines