statistics - Easiest way to create an irregular time series graph (R? GGPLOT? ITS?) -
i'm graphic designer trying use r create graphs complicated excel. i'm trying create irregular time series step chart. i've had no problems creating regular time series chart, reason, irregular dates throwing off.
i'm starting basic text file 2 columns of data:
01-04-1940 4 05-29-1963 35 12-02-2002 24
i've loaded data using
d <- read.delim("file.txt", header = true)
and i've converted first column in unix time using
d$date <- as.date(d$date, format = "%m-%d-%y")
but @ point, can't find more information anywhere on how proceed. i've seen r package "its," cannot find documentation on beyond technical descriptions of classes involved.
i'd appreciate if experience in r point out few lines of code need create graph. thanks!
ggplot
deals quite nicely data in date format. here suggestions:
d <- data.frame( date = c("01-04-1940", "05-29-1963", "12-02-2002"), value = c(4, 35, 24) ) d$date <- as.date(d$date, format = "%m-%d-%y") ggplot(d, aes(x=date, y=value)) + geom_step(colour="blue")
ggplot(d, aes(x=date, y=value)) + geom_line(colour="red")
Comments
Post a Comment