按数据框中的变量名选择变量
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.
附件列表
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。