【发布时间】:2014-04-16 09:48:42
【问题描述】:
我正在尝试在 R 中获取我的字符向量中的平均单词数
one <- c(9, 23, 43)
two <- c("this is a new york times article.", "short article.", "he went outside to smoke a cigarette.")
mydf <- data.frame(one, two)
mydf
# one two
# 1 9 this is a new york times article.
# 2 23 short article.
# 3 43 he went outside to smoke a cigarette.
我正在寻找一个函数,它可以为我提供字符向量“two”的平均单词数。
这里的输出应该是 5.3333 (=(7+2+7)/3)
【问题讨论】:
标签: r dataframe character word-count