ℕʘʘḆḽḘ
ℕʘʘḆḽḘ

Reputation: 19375

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

Consider the following text

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

If I copy and paste this text and I try to put it into a variable, like this:

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

that will not work because the quotation marks are imbalanced.

Is there a simple solution? How can I copy and paste this text to my R script?

Upvotes: 4

Views: 230

Answers (1)

d.b
d.b

Reputation: 32538

Text to copy

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.

Read into R

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

Convert to 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.

Instead of "clipboard", you could also paste the copied text in a file and use readLines with it.

Upvotes: 2

Related Questions