公卫百科  > 所属分类  >  R/S+   
[0] 评论[0] 编辑

按数据框中的变量名选择变量

 select columns from a data frame according to their name

公卫百科

dfrm[["name"]]
Returns one column, the column called name.
dfrm$name
Returns the same, but presented in different syntax.
dfrm["name"]
Selects one column and packages it inside a data frame object. 公卫家园
dfrm[c("name1", "name2", ..., "namek")]
Selects several columns and packages them in a data frame.
dfrm[, "name"]
Returns the named column.
dfrm[, c("name1", "name2", ..., "namek")]

公卫考场


Selects several columns and packages them in a data frame.

 If you know the name, it’s usually more convenient and readable to select by name, rather than by position.

附件列表


0

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

如果您认为本词条还有待完善,请 编辑

上一篇 数据框索引    下一篇 计算均数的可信区间

同义词

暂无同义词