Split Strings into values in long dataframe format [duplicate]
问题 This question already has answers here : Split comma-separated strings in a column into separate rows (6 answers) Split delimited strings in a column and insert as new rows [duplicate] (6 answers) Closed 3 years ago . I have a dataframe that looks like the following example df which consist of a character variable VAR . df<-data.frame(ID = 1:2, VAR = c("VAL1\r\nVAL2\r\nVAL8","VAL2\r\nVAL5"), stringsAsFactors = FALSE) # ID VAR # 1 1 VAL1\r\nVAL2\r\nVAL8 # 2 2 VAL2\r\nVAL5 I would like to split