R graphics plotting a linegraph with date/time horizontally along x-axis
Posted
by
user2978586
on Stack Overflow
See other posts from Stack Overflow
or by user2978586
Published on 2013-11-11T09:48:34Z
Indexed on
2013/11/11
9:53 UTC
Read the original article
Hit count: 130
I want to get a linegraph in R which has Time along x and temperature along y. Originally I had the data in dd/mm/yyyy hh:mm format, with a time point every 30 minutes. https://www.dropbox.com/s/q35y1rfila0va1h/Data_logger_S65a_Ania.csv
Since I couldn't find a way of reading this into R, I formatted the data to make it into dd/mm/yyyy and added a column 'time' with 1-48 for all the time points for each day
https://www.dropbox.com/s/65ogxzyvuzteqxv/temp.csv
This is what I have so far:
temp<-read.csv("temp.csv",as.is=T)
temp$date<-as.Date(temp$date, format="%d/%m/%Y")
#inputting date in correct format
plot(temperature ~ date, temp, type="n")
#drawing a blank plot with axes, but without data
lines(temp$date, temp$temperature,type="o")
#type o is a line overlaid on top of points.
This stacks the points up vertically, which is not what I want, and stacks all the time points (1-48) for each day all together on the same date. Any advice would be much appreciated on how to get this horizontal, and ordered by time as well as date.
© Stack Overflow or respective owner