Re: [R] Working with temporal data

2007-02-16 Thread Sérgio Nunes
Hi again, I'm still trying to read my data but I'm having some difficulties converting it to dates. My data file has lines and in each line a single date exists in the format 2007/02/16 (without the ,). I've tried the following: d - readLines(file.dat) d [1] 2006/08/09 2004/02/11 2004/06/09

Re: [R] Working with temporal data

2007-02-16 Thread jim holtman
One question I would have about your commands is that I would have thought that the second line of output ([2].) would have started with at least [4] if you were reading multiple lines. This example seems to work fine: (now that I looked at your code you had $d instead of %d) x -

Re: [R] Working with temporal data

2007-02-16 Thread Marc Schwartz
On Fri, 2007-02-16 at 14:32 +, Sérgio Nunes wrote: Hi again, I'm still trying to read my data but I'm having some difficulties converting it to dates. My data file has lines and in each line a single date exists in the format 2007/02/16 (without the ,). I've tried the following: d -

Re: [R] Working with temporal data [Solved]

2007-02-16 Thread Sérgio Nunes
Just for the record, here are my steps for producing a date based histogram. Data is stored in a file where each line only has a date - 2007/02/16 d-readLines(filename.dat) d-as.Date(d, format=%Y/%m/%d) pdf(yearly.pdf) hist(d, years) dev.off() Instead of years you can also use days, weeks,

Re: [R] Working with temporal data [Solved]

2007-02-16 Thread Marc Schwartz
On Fri, 2007-02-16 at 15:39 +, Sérgio Nunes wrote: Just for the record, here are my steps for producing a date based histogram. Data is stored in a file where each line only has a date - 2007/02/16 d-readLines(filename.dat) d-as.Date(d, format=%Y/%m/%d) pdf(yearly.pdf) hist(d, years)

Re: [R] Working with temporal data [Solved]

2007-02-16 Thread Prof Brian Ripley
On Fri, 16 Feb 2007, Marc Schwartz wrote: On Fri, 2007-02-16 at 15:39 +, Sérgio Nunes wrote: Just for the record, here are my steps for producing a date based histogram. Data is stored in a file where each line only has a date - 2007/02/16 d-readLines(filename.dat) d-as.Date(d,

Re: [R] Working with temporal data [Solved]

2007-02-16 Thread Marc Schwartz
On Fri, 2007-02-16 at 16:47 +, Prof Brian Ripley wrote: On Fri, 16 Feb 2007, Marc Schwartz wrote: On Fri, 2007-02-16 at 15:39 +, Sérgio Nunes wrote: Just for the record, here are my steps for producing a date based histogram. Data is stored in a file where each line only has a

[R] Working with temporal data

2007-02-15 Thread Sérgio Nunes
Hi, I have several files with data in this format: 20070102 20070102 20070106 20070201 ... The data is sorted and each line represents a date (MMDD). I would like to analyze this data using R. For instance, I would like to have a histogram by year, month or day. I've already made a simple

Re: [R] Working with temporal data

2007-02-15 Thread Petr Klasterecky
Sérgio Nunes napsal(a): Hi, I have several files with data in this format: 20070102 20070102 20070106 20070201 ... The data is sorted and each line represents a date (MMDD). I would like to analyze this data using R. For instance, I would like to have a histogram by year, month

Re: [R] Working with temporal data

2007-02-15 Thread jim holtman
Here is a start on what you want to do. This generates some test data and then does a couple of summaries: # generate some data N - 1000 x - data.frame(date=as.character(2007 + sample(1:4, N, TRUE) * 100 + sample(1:31, N, TRUE)), + value=runif(N)) head(x) # display the data

Re: [R] Working with temporal data

2007-02-15 Thread Sérgio Nunes
Please note that I do not have values, only dates that represent occurrences (one link, one date, one occurrence). This means that the same date might appear several times in different rows. Nevertheless, I think I can manage this based on your samples. Thanks, Sérgio Nunes On 2/15/07, jim