02 March 2014

**[R] First plot using R {update}**

What's all the fuss about R.
I've spent the last 2 weeks reading many R tutorials to find which version the simplest.

Finally I chose one and started to type the instructions.

x<-c p="">y<-c p="">plot(x,y)

x is my birth date and y is my wife's.

Press enter then 
voila 


More complicated one:

#PLOTTING GW TDS VS RIVER TDS
#this practice was based on Ciliwung dataset
#so you can change all the ciliwung file data with your own data
 
#loading data and named clwtds
clwtds <- clwtds.csv="" font="" header="T,sep=" read.table="">
attach(clwtds)
 
#view the data
clwtds
 
#Scatter plot gwtds vs rivtds
plot(gwtds,rivtds,xlab="Groundwater TDS (ppm)",ylab="Ciliwung Water TDS (ppm)", pch=16)
 
#Scatter plot gwtds vs rivtds (based on gw and river water relation)
> plot(gwtds, rivtds, xlab="Groundwater TDS (ppm)", ylab="Ciliwung Water TDS (ppm)", pch=19, col=c(relation))
 
#Histogram chart
 
#Histogram gwtds and rivtds in the file clwtds
hist(clwtds$gwtds, xlab="Groundwater TDS (ppm)")
hist(clwtds$rivtds, xlab="River TDS (ppm)")
 
#this is the result
 
#TDS Profile with line chart
plot(clwtds$gwtds, type="b", pch=16, xlab="Location", ylab="TDS (ppm)", ylim=c(0,1000))
points(clwtds$rivtds, type="b", pch=16, col="grey", lwd=2)
#this is how the chart will look like



{@dasaptaerwin}

No comments: