R语言数据处理方法~小结
3.1.4 选择select用列名作参数来选择子数据集: select的特殊函数 (1)starts_with(x,ignore.case = TRUE): names starts with x (2)ends_with(x,ignore.case = TRUE): names ends in x (3)contains(x,ignore.case = TRUE): selects all variables whose name contains (4)matches(x,ignore.case = TRUE): selects all variables whose name matches the regular expression x (5)num_range("x",1:5,width = 2): selects all variables (numerically) from x01 to x05. (6)one_of("x","y","z"): selects variables provided in a character vector. (7)everything(): selects all variables. ":" 选择连续列,contains来匹配列名 同样类似于R自带的subset() 函数. 对已有列进行数据运算并添加为新列: mutate_each() 对每一列运行窗体函数。 通过data.frame有可以实现 3.1.6 汇总summarise (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |