通过传递索引的列表/向量,从data.frame获取值的列表/向量

时间:2012-10-20 13:04:42

标签: r dataframe

indices <- c(2,5,9)

客户是data.frame。

我想要索引的索引位置中客户第2列的值列表。

names <- as.list(customer[,2] << indices)

1 个答案:

答案 0 :(得分:3)

听起来你想从数据框中做一个简单的提取。尝试:

customer[indices, 2]