49绘图函数

1.基础绘图系统graphics、lattice包、ggplot2包、grid包

2.ls("package:graphics")列出有什么函数、demo(graphics)样式help(package=graphic)

3.R绘图输入数据

散点图:x和y  直方图:因子 箱线图:因子+向量  热图:数据矩阵

实例

women

散点图:x和y       plot(women$height,women$weight)

直方图:因子       plot(as.factor(women$height))

箱线图:因子+向量     plot(as.factor(mtcars$cyl),mtcars$mpg)

热图:数据矩阵               heatmap(state.x77)

波浪号~:两者关系图 plot(women$height~women~weight)

线性回归:plot(fit<-lm(height~weight,data=women))

50自定义函数

1.R中循环

if条件判断  、for循环 、while循环 、switch语句

循环三部分:1条件判断,是真或者假2 用于循环执行的结构3表达式

x<- for(i in(1:10 )[print("IloveLijianguo")])