[R] Dense time series

John Kane jrkrideau at inbox.com
Mon Dec 7 13:16:52 CET 2015


Please have a look at
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html

Probably the image and your code did not come through because R-help is very picky about what types of files it allows as a security mesure.  Code probably would make it if it sent as a .txt file not a .r file. For an image, try, IIRC, png or a pdf file.

Generally speaking,  it is best to provide code and data in the email itself.

If sending sample data, and it is a good idea to do so, use dput() as described in the links above or have a look at ?dput.

Using dput ensures that the R-help reader is seeing the data as you see it.  

BTW should not "Looks fine in excel" actually read, " Looks vaguely acceptable in Excel, given the limitations of a spreadsheet graphs"? :)
John Kane
Kingston ON Canada


> -----Original Message-----
> From: rhelp10 at gmail.com
> Sent: Sun, 6 Dec 2015 19:49:55 -0500
> To: wdunlap at tibco.com
> Subject: Re: [R] Dense time series
> 
> Hello,
> 
> Thank you for the reply.
> 
> I ran the code with your added code. The code itself works however I am
> unable to see how the graphs actually plot because the plot area is so
> small and it produces lots of separate graphs.
> 
> What I mean by dense is that some lines plot well, then there is a group
> that looks like one clump, however the data is not clumped. I changed the
> size to 0 but a few are still to dense.
> 
> You mentioned you can't see the photo I attached, should I resend?
> 
> 
> 
> On Sun, Dec 6, 2015 at 7:27 PM, William Dunlap <wdunlap at tibco.com> wrote:
> 
>> I cannot see either your data or your picture.  Does the following
>> dataset
>> along with your ggplot command give a similar picture?
>> 
>> TS <- data.frame(Well=paste0("Well",rep(1:21,each=3)),
>> LOCATION=paste0("Loc",rep(LETTERS[1:7],each=9)),
>> Date=as.POSIXct(paste(sep="-", 2015, 10, rep(c(11,18,25),21))),
>> HYDRAULIC_HEAD.cm.=100*(log2(1:63)+sin(1:63)+1))
>> 
>> If so, then describe what you mean by 'dense'.  I prefer finer lines,
>> like those produced by geom_line(size=0), but I don't know if that
>> is what you mean by dense..
>> 
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>> 
>> 
>> On Sun, Dec 6, 2015 at 1:18 PM, DJ L <rhelp10 at gmail.com> wrote:
>>> Hello R users!
>>> 
>>> Any idea why this looks so dense? Should be line graphs. Looks fine in
>>> excel.  The csv file is four columns, first date, second well number, 3
>>> well location (ditch or interior), and then the last column is
>>> hydraulic
>>> head. Thank you!  I have attached a photo and the R code I am using.
>>> 
>>> setwd("c:/users/dot/desktop/r")
>>> 
>>> TS<-read.csv("TS_EAV1_SANDY.csv", header=TRUE,
>>> sep=",",stringsAsFactors=FALSE)
>>> 
>>> # CHECK
>>> 
>>> head(TS)
>>> 
>>> str(TS)
>>> 
>>> #FORMAT DATE AND TIME
>>> 
>>> TS$Date <- as.POSIXct(TS$Date, tz = "", origin = "2012/10/22 0:00")
>>> 
>>> # CHECK
>>> str(TS)
>>> 
>>> library(ggplot2)
>>> library(scales)
>>> 
>>> #PLOT
>>> 
>>> xytheme <- theme(panel.background = element_blank(),
>>>                  panel.grid.major.y = element_line(colour = "grey"),
>>>                  panel.grid.minor.y = element_blank(),
>>>                  panel.grid.major.x = element_line(colour = "grey"),
>>>                  panel.grid.minor.x = element_blank(),
>>>                  panel.border = element_rect(color = "black", fill =
>>> NA),
>>>                  axis.text = element_text(color = "black", size =
>> rel(1)),
>>>                 legend.title = element_blank())
>>> 
>>> ###THIS ONE WORKS###
>>> 
>>> ggplot(TS, aes(Date, HYDRAULIC_HEAD.cm., group = Well)) +
>>>   facet_grid(LOCATION~.) +
>>>   geom_line(size=1) + xytheme +
>>>   labs(x = "EAV1",y = "Water Levels, cm")+
>>> scale_x_datetime(breaks = date_breaks("2 days"), labels =
>>> date_format("%m/%d/%y"))
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!



More information about the R-help mailing list