> Plot (x1,x2,+ main= ' two-course performance relationship ', #图标题 + xlab= ' math ', #x轴标签 + ylab= ' Chinese ', #y轴标签 + xlim=c (0,100), #x轴范围 + ylim=c (0,100), #y轴范围 + Xaxs= ' i ', #x轴类型 + yaxs= ' r ', + col= ' red ', #颜色 + pch=19) #点的大小
> Qqnorm (x1) #测试x1是否是正态分布. A scatter plot > qqline (x1) #上面画出的散点图不能关闭 appears. Draw a straight line, the closer to the line, the more close to the normal distribution.
> num=seq (1,100) #创建学号 > X1=round (runif (100,80,100)) #创建成绩, evenly distributed, 100 numbers, min 80, max 100. > X2=round (Rnorm (100,80,7)) #创建成绩, normal distribution, 100 numbers, average 80, standard deviation 7 > #创建成绩, normal distribution, 100 numbers, average 83, standard deviation from X3[which (x3> 100)]=100# x3 The number greater than 100 into > X=data.frame (num,x1,x2,x3) >write.table (x,file= ' c:\\users\\qjtsj\\desktop\\r Working file\\mark.txt ') #写入文件, need to be created in advance > Colmeans (x) #对列求平均值
> hist (x$x1) #频率分布图 > plot (x$x1,x$x2) #散点图 > table (x$x1) #列联函数, frequency 80 of univariate 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 5 7 4 6 9 3 3 3 2 4 3 6 6 5 5 3 3 7 6 99 100 7 3 > barplot (table (x$x1)) #柱状图 > pie (table (x$x1)) #饼图 > boxplot (x$x1,x$x2,x$x3) #箱体图 > stars (x[c (' x1 ', ' x2 ', ' x3 ')]) #星象图 Note that Stars ' object ' x ' is either a matrix or a data frame. X$x1,x$x2,x$x3 not. > stars (x[c(' x1 ', ' x2 ', ' x3 ')],full=t,draw.segment=t) #另外的效果
Xiao Bai began to learn R