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 (YYYYMMDD). 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 Perl script that aggregates this data but I
> believe that R can be much more powerful and easy on this kind of
> work.
> 
> Any suggestions on where to start?
> 
> Thanks in advance,
> Sérgio Nunes

Analysing a particular day is easy - just call e.g. 
hist(your.variable[day==20070101])
if 'day' contains the date stored as an integer.

If you want to do this for all days probably you mmight use a loop 
through unique(day)

Finally, to do a monthly/yearly analysis, just create 'month' and 'year'
month <- trunc(day/100)
year <- trunc(day/10000)

HTH
Petr Klasterecky
-- 
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

______________________________________________
R-help@stat.math.ethz.ch mailing list
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.

Reply via email to