My data:
Topic Content
Sunny "Today is a sunny day."
John He listened and walked away."Should I visit Dr.Mary today?"
May May is playing alone.
I want to extract everything that is inside "everything in this quotation".
Also, I would like to create another column to give the sentence the name, such as if the content has the keyword of "Sunny", the new column will input as "Sunny", if the content has the keyword of "visit", "Hospital" will be inputted in the new column for the row.
I would like to get the output below:
Topic Content Tag
Sunny "Today is a sunny day!" Sunny
John "Should I visit Dr.Mary today?" Hospital
dput:
structure(list(Topic = structure(c(3L, 1L, 2L), .Label = c("John",
"May", "Sunny"), class = "factor"), Content = structure(c(3L,
1L, 2L), .Label = c("He listened and walked away.\"Should I visit Dr.Mary today?\"",
"May is playing alone.", "Today is a sunny day. "), class = "factor")), .Names = c("Topic",
"Content"), class = "data.frame", row.names = c(NA, -3L))