Splitting text using a specific phrase - Extended Text to Columns function

Hi,
I have a data frame with two character fields merged.

source <- data.frame(
  stringsAsFactors = FALSE,
       check.names = FALSE,
    `Interview ID` = c("aaa", "bbb", "ccc", "ddd", "eee"),
                               Verbatim = c("Points particularily disliked:long time to hang about the estate .",NA,
                                            "Points particularily liked: washPoints particularily disliked: None totally happy",
                                            "Points particularily liked: Car was returned Points particularily disliked: Nothing",
                                            "Points particularily liked: Staff polite.")
                     )

I want to split them by a specific phrases and have two separate columns with text: one with "Points particularily liked" and one with "Points particularily disliked". Obviously these descriptors should be removed from comments.
As a result I would like to have something like this.

result<- data.frame(
  stringsAsFactors = FALSE,
       check.names = FALSE,
    `Interview ID` = c("aaa", "bbb", "ccc", "ddd", "eee"),
          Verbatim = c("Points particularily disliked:long time to hang about the estate .",NA,
                       "Points particularily liked: washPoints particularily disliked: None totally happy",
                       "Points particularily liked: Car was returned Points particularily disliked: Nothing",
                       "Points particularily liked: Staff polite."),
             Liked = c(NA, NA, "wash", "Car was returned", "Staff polite."),
                                 Disliked = c("long time to hang about the estate .",NA,"None totally happy","Nothing",NA,
                       NA)
)

Is it easy to do?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.