Assignment 4(plot, sort, order)


title: "Assignment04.ZhenningLi"
author: "ZhenningLI"
date: "February 9, 2017"
output: html_document
description: Assigment for OCN682 using the dataset from waters off eastern Canada.


Exercise 2

EData<-read.csv("C:/Users/User/Desktop/EnvA04.csv", header=TRUE)
#Input the data as a data frame named EData

Exercise 3

EData$myDate<-strptime(EData$SampleDate,format = "%d.%m.%Y") #Restore the date as a standard format
EData$Month<-format(EData$myDate,"%m") #Extract month from  the SampleDate column

Exercise 4

EDataS<-EData[order(EData$Month),] #sort the data
plot(Chl~Month,data=EDataS[which(EDataS$Station=="S27"),],type="l",lty=2,col='blue',lwd=2,ylim=c(20,300),xlab="Month",ylab=expression(paste('Chorophyll, mg  ','m'^'-2')))#plot chl~Month with the subset of station=S27
lines(Chl~Month,data=EDataS[which(EDataS$Station=="HL2"),],type="l",lwd=2) #plot chl~Month with the subset of station=HL2
text(6,100,"S27",col='blue') #text(x,y,'char',col)
text(5,250,"HL2") #text

Paste_Image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容