[R] 简单笔记(一)
1 library(lattice) 2 3 xyplot(Petal.Length~Petal.Width,data=iris,goups = Species)//画分类图 4 5 6 7 plot(model,subdata,Petal.Length~Petal.Width)//画模型预测图 8 9 hist(x,col="light blue") //直方图 频率分布 10 11 abline(rs,cars)//添加图 12 13 factor(因子) 不作为数值参与运算 14 15 # Create a vector as input. 16 17 data <- c("East","West","East","North","North","East","West","West","West","East","North") 18 19 20 21 print(data) 22 23 print(is.factor(data)) 24 25 26 27 # Apply the factor function. 28 29 factor_data <- factor(data) 30 31 32 33 print(factor_data) 34 35 print(is.factor(factor_data)) 36 37 38 39 40 41 决策树: 42 43 ctree(formula,data) 44 45 plot(..) 46 47 随机森林 48 49 library("randomForest") 50 51 randomForest(formula,data)