服务热线
178 0020 3020
作业1
用内置函数“pressure”数据来绘制简单箱线图,并学习调节相关参数。
pressure
boxplot(pressure,col='green',warwidth=FALSE,border='red')
varwidth
若=TRUE,每个盒子的宽度与盒子所表示的观察数的平方根相关。若=FALSE,则所有盒子的宽度都是一样的。
作业2
A: 学习设置默认工作空间以及查看默认工作空间,并复习读入CSV文件并画箱线图。
查看
> getwd()
[1] "C:/Users/M/Downloads"
设置
setwd('/Users/M/Documents')
利用data2作图
对比用pdf输出和png,jpeg等函数输出图片的区别。
a<-read.csv('data2.csv',header=T)
boxplot((a[,1:3]),notch=T,col=c('green','red','blue'),main='adults body index')
B:最终提交作业以因子T,分类画出身高的boxplot。
要求:使用setwd()函数设置默认工作空间为R(自己新建),文件夹,读入读出均在次文件夹中进行;boxplot的box水平;并使用read.csv读入数据,pdf函数输出。(提示,颜色可以使用rainbow())
boxplot((a$Height~a$T),col=c('green','red','blue'),main='Adult’s body index',horizontal=T)
作业3
数据:见附件1
数据前处理一下
KRAS | NRAS | HRAS | tissue | ||||
GSM543161 | 98.36407 | 251.9014 | 562.402 | Tumor | |||
GSM543162 | 260.3064 | 284.8315 | 646.8896 | Tumor | |||
GSM543163 | 153.9696 | 101.018 | 763.1626 | Tumor | |||
GSM543164 | 305.4082 | 320.966 | 1017.782 | Tumor | |||
GSM543205 | 228.526 | 455.2713 | 141.2023 | Tumor | |||
GSM543206 | 207.7723 | 284.3415 | 318.1258 | Tumor | |||
GSM543207 | 239.115 | 224.3648 | 637.0992 | Tumor | |||
GSM543208 | 255.253 | 467.9284 | 434.2783 | Tumor | |||
GSM543249 | 115.1559 | 208.4306 | 548.5527 | Tumor | |||
GSM543250 | 302.1453 | 168.1767 | 482.6645 | Tumor | |||
GSM543251 | 213.0536 | 252.4167 | 250.1489 | Tumor | |||
GSM543252 | 142.7571 | 226.4206 | 235.276 | Tumor | |||
GSM543253 | 77.18252 | 226.791 | 153.9643 | Tumor | |||
GSM543254 | 324.536 | 350.7875 | 804.169 | Tumor | |||
GSM543255 | 88.13098 | 66.24825 | 165.1883 | Normal | |||
GSM543256 | 150.2363 | 153.4069 | 345.582 | Normal | |||
GSM543257 | 132.1101 | 89.7925 | 218.4636 | Normal | |||
GSM543258 | 189.1159 | 136.9771 | 359.2644 | Normal | |||
GSM543259 | 243.1905 | 157.58 | 351.8555 | Normal | |||
GSM543260 | 319.5778 | 287.2694 | 249.4139 | Normal | |||
GSM543261 | 163.2116 | 146.3472 | 164.6731 | Normal | |||
GSM543262 | 165.697 | 208.7389 | 279.6108 | Normal | |||
GSM543263 | 100.6358 | 194.2763 | 166.1631 | Normal | |||
a<-read.csv('data1.csv',header=T)
a
b<-a[,-1]
boxplot(KRAS~tissue,data=b,col='red',main='RAS expression',boxwex=0.1,at=1:2-0.2,ylim=c(1,2000),axes=F)
boxplot(NRAS~tissue,data=b,col='green',add=T,ylab='expression',boxwex=0.1,at=1:2)
boxplot(HRAS~tissue,data=b,col='yellow',add=T,boxwex=0.1,at=1:2+0.2,axes=F)
legend('topleft',inset=0.1,c('KRAS','NRAS','HRAS'),col=c('red','green','yellow'),pch=c(15,15,15))
附件