I have a data frame like this:
df = data.frame(a=1:3, b=2:4, c=3:5)
I am selecting columns from that data frame using something akin to:
df[, c(T, F, T)]
This works fine as long as there are at least two columns to be returned; but, if I do this for example:
df[, c(T, F, F)]
...我突然间只得到了一个矢量 而不是一个数据.框架。
通常这样很好(甚至更理想), 但是因为我需要结果成为数据. 框架,
是否有办法可以阻止 R 自动转换为向量, 用于单列选择?