Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/157.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何自动统计列表中不同字符串的出现次数_R_String_Data Wrangling - Fatal编程技术网

R 如何自动统计列表中不同字符串的出现次数

R 如何自动统计列表中不同字符串的出现次数,r,string,data-wrangling,R,String,Data Wrangling,我有一个约1000个条目的列表,其结构如下(小示例): 示例所有字符串 example <- list( "1" =c("car","house"), "2" = c("family","work","car"), "3" = c("house","Work","car"

我有一个约1000个条目的列表,其结构如下(小示例):

示例
所有字符串
example <- list(
"1" =c("car","house"), 
"2" = c("family","work","car"), 
"3" = c("house","Work","car"),
"4" = "school", 
"5" = c("Car","school"))
all_strings <- tolower(unlist(example, use.names = FALSE))
#How many different string
length(unique(all_strings))
#[1] 5

#How often the different strings occur
all_string_listwise <- tolower(unlist(lapply(example, unique)))
table(all_string_listwise)

#all_string_listwise
#   car family  house school   work 
#     4      1      2      2      2