Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试根据行号向量从数据框中提取值向量;
df<-iris x<-c(1,5,15,8,7,2)
我想要向量 x 中列出的行号的相应 Species。我尝试过类似的东西df$Species[x,],df$Species[list(x),]但无济于事。我确信答案很简单,但我就是看不到!
df$Species[x,]
df$Species[list(x),]
提前致谢
尝试
df[x,]$Species
或者
df[,"Species"][x]
或者确实
df[x,"Species"]