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

Assignment 4(plot, sort, order)_第1张图片
Paste_Image.png

你可能感兴趣的:(Assignment 4(plot, sort, order))