从字符列表中获取单词

时间:2018-10-25 23:44:15

标签: r list

我有一个字符列表(标签),其中某些元素包含多个单词。

它看起来像这样:

head(hashtags)
[[1]]
[1] "FutureofAccountechs"

[[2]]
[1] "internet" "Cornwall"

[[3]]
[1] "beer"

[[4]]
[1] NA

[[5]]
[1] "popsicle" "natural" 

[[6]]
[1] "coffee"  "ethical"

我需要从此列表中提取单个单词。通过元素编号访问它们:

> hashtags[[5]]
[1] "popsicle" "natural" 
> hashtags[5][[1]]
[1] "popsicle" "natural" 

任何想法我都可以“展平”它们,所以它们是

"FutureofAccountechs"
   "internet" 
   "Cornwall"
   "beer"
   NA
   "popsicle" 
   "natural" 
   "coffee"  
   "ethical"

0 个答案:

没有答案