Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.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_List_String Length - Fatal编程技术网

R:提取大列表中字符的长度

R:提取大列表中字符的长度,r,list,string-length,R,List,String Length,是否有可能创建一个变量来捕获R中大列表中每个chr字符串的长度 例如,在上面的图片中,我想创建一个变量,该变量捕获第一个chr的长度为0,第二个chr的长度为3,第三个chr的长度为4,依此类推 谢谢 sapply(hunspell, length) 这将length函数应用于hunspell的每个元素,并将结果作为向量返回。这就是你想要的吗 这将length函数应用于hunspell的每个元素,并将结果作为向量返回。这就是您想要的吗?长度命令是内置的,不需要应用 lengths(list(c

是否有可能创建一个变量来捕获R中大列表中每个chr字符串的长度

例如,在上面的图片中,我想创建一个变量,该变量捕获第一个chr的长度为0,第二个chr的长度为3,第三个chr的长度为4,依此类推

谢谢

sapply(hunspell, length)
这将
length
函数应用于
hunspell
的每个元素,并将结果作为向量返回。这就是你想要的吗


这将
length
函数应用于
hunspell
的每个元素,并将结果作为向量返回。这就是您想要的吗?

长度
命令是内置的,不需要应用

lengths(list(c("test", "one"),
         c("testingtwo"),
         c("this", "is", "test", "three")
        ))

[1] 2 1 4

length
命令是内置的,不需要应用

lengths(list(c("test", "one"),
         c("testingtwo"),
         c("this", "is", "test", "three")
        ))

[1] 2 1 4

非常感谢,这就是我要找的!非常感谢,这就是我要找的!