Hello everyone,

I have a data generated in a way similar to the following

library(chron);library(zoo)
date<- seq(as.Date("1990-01-01"),, as.Date("2000-12-31"), by = 1)
obs<- zoo(rnorm(length(date), mean = 10, sd = 2.5), order.by = date)
monthly<- function(date) as.Date(as.yearmon(Date))
result<- data.frame ( Date = obs = aggregate(obs, monthly, sum))

Now,
I want to get the result data in the following format instead of the
 continuous table
Observation for year 1990,
1990-01-01 314.7547
1990-02-01 266.0105
1990-03-01 353.7275
1990-04-01 273.8321
1990-05-01 325.3691
1990-06-01 253.1501
1990-07-01 318.1684
1990-08-01 291.2097
1990-09-01 298.6409
1990-10-01 304.0167
1990-11-01 279.4668
1990-12-01 286.9456
Total for year 1990 = xxx

Observation for year 1991
1991-01-01 313.1515
1991-02-01 297.9274
1991-03-01 315.2565
1991-04-01 290.9797
1991-05-01 327.0480
1991-06-01 281.5030
1991-07-01 316.7332
1991-08-01 289.9122
1991-09-01 296.9334
1991-10-01 280.2053
1991-11-01 295.6098
1991-12-01 321.6451
Total for year 1991 = xxx


Any help would be highly appreciated

Thanks





-- 
Acharya, Subodh

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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