[英]Vector of vectors in R but not is matrix
I have a little problem using vector of vector. 我在使用vector向量时遇到了一些问题。 In my routine R, : don't know how create and assign elements to a vector of vectors but not is a matrix Some columns or rows have more elements than others.Then be able to call one of the elements
在我的例行程序R中::不知道如何为向量的向量创建元素并将其分配给一个向量,但不是一个矩阵有些列或行比其他列或行具有更多的元素,因此可以调用其中一个元素
for example the vector : 例如向量:
v=( c(1,2,3) , c(3,4,5,1,3,4,1,) , c(3,4) , c(3,3,3,3,3,1,2,) )
then, v[3]
should show (3,4)
然后,
v[3]
应该显示(3,4)
I tried a for for (i in 1:k){t[i] <- x[v[[j]](x) > w[j]]}
我尝试了for
for (i in 1:k){t[i] <- x[v[[j]](x) > w[j]]}
but is bad 但是不好
Use a list: 使用清单:
myList <- list(c(1,2,3), c(3,4,5,1,3,4,1,) , c(3,4), c(3,3,3,3,3,1,2,))
> myList[3]
[[1]]
[1] 3 4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.