我已经从twitter中提取了数据,它显示为List列(运行代码后会得到什么)。我希望输出显示为“损坏”列中的内容。
data <- data.frame(matrix(, nrow=4, ncol=2))
colnames(data)[1:2] <- c("List", "Broken")
data$List[1] <- 1
data$List[2] <- list(c("1", "SmythsToysUK"))
data$List[3] <- list(c("1", "FortniteGame", "CityCtrMirdif", "itpliveme"))
data$List[4] <- 1
data$Broken[1:4]<- c("SmythsToysUK","FortniteGame","CityCtrMirdif","itpliveme")
We can remove all the numbers from
List
column.We can use
grep
withunlist
. Afterunlist
ing thelist
, select only the elements that have lettersOr another option is to remove the first element which seems to be index and then
unlist
注意:使用此选项,不会有任何警告