I have an R data frame with 6 columns, and I want to create a new dataframe that only has three of the columns.
(我有一个包含6列的R数据框,并且我想创建一个仅包含三列的新数据框。)
Assuming my data frame is df
, and I want to extract columns A
, B
, and E
, this is the only command I can figure out:
(假设我的数据帧是df
,并且我想提取列A
, B
和E
,这是我唯一能知道的命令:)
data.frame(df$A,df$B,df$E)
Is there a more compact way of doing this?
(有没有更紧凑的方法可以做到这一点?)
ask by Aren Cambre translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…