1. 按属性排序
mtcars[order(mpg),]
升降序
mtcars[order(mpg, cyl),]
2.apply
https://stackoverflow.com/questions/4236368/apply-a-function-to-every-row-of-a-matrix-or-a-data-frame
https://www.r-bloggers.com/using-apply-sapply-lapply-in-r/
3.正则表达式及R字符串处理之终结版
http://yphuang.github.io/blog/2016/03/15/regular-expression-and-strings-processing-in-R/
常规正则
http://www.runoob.com/regexp/regexp-syntax.html
4.转变成数字
as.numeric
But, if all the columns needs to changed to numeric
, use lapply
to loop over the columns and convert to numeric
by first converting it to character
class as the columns were factor
.
lapply(data, function(x) as.numeric(x))
5.R判断!一个元素是否在集合
https://blog.csdn.net/u011402596/article/details/43938093 ,%in%
6.R语言Data Frame数据框常用操作, 高级SQL 选择
http://www.cnblogs.com/studyzy/p/R_DataFrame_Operation.html
7.String r 处理包
http://blog.fens.me/r-stringr/
8 画 多个图
matplot(data , type = c(b),col = 1:2)