How to copy and paste a line with unbalanced quotes?

Consider the following text

Today Stack Overflow Day Skips Goal of the Year

If I copy and paste this text and I try to put it in a variable, for example:

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

this will not work because the quotation marks are unbalanced.

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

+4
source share
1 answer

Text in cop y

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

Reading in 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 target.
#2 Yesterday is the day "Stack Overflow" will miss its year target sum.

Instead, "clipboard"you can also paste the copied text into a file and use with it readLines.

+2
source

Source: https://habr.com/ru/post/1692771/


All Articles