Prevent automatic conversion of single column to vector

前端 未结 2 1131
悲&欢浪女
悲&欢浪女 2020-12-10 02:49

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:

2条回答
  •  感动是毒
    2020-12-10 03:11

    Also without the comma, i.e. df[c(T,F,F)], returns a dataframe but it sounds like you have cases where the new dataframe can have one or more columns. So use the drop option abovee

提交回复
热议问题