gpt4 book ai didi

list - R:计算列表中对象的数量

转载 作者:行者123 更新时间:2023-12-03 04:53:56 24 4
gpt4 key购买 nike

有人可以推荐一个函数,可以让我计算并返回列表中的项目数吗?

library(stringr)

l <- strsplit(words, "a")

if(# number of items in list l < 1)
next

最佳答案

length(x)

Get or set the length of vectors (including lists) and factors, and of any other R object for which a method has been defined.

lengths(x)

Get the length of each element of a list or atomic vector (is.atomic) as an integer or numeric vector.

关于list - R:计算列表中对象的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1740524/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com