On Tue, Feb 21, 2012 at 2:25 AM, jpm miao <miao...@gmail.com> wrote: > Hello, > > I try to handle the data using read.csv , zoo and aggregate functions. > The data contains NA values. After aggregating monthly data into quarterly > data, all data become NA. Is it because I don't properly aggregate the data > in the presence of NAs? What can I do? > > Another problem is that the date in month is presented in Chinese (My OS > is in Chinese.) How can I set the default language to English? > > Thanks, > > Miao >
mean has an na.rm = TRUE argument you can use. See ?mean library(zoo) z <- zoo(c(1:4, NA), as.Date("2000-01-01") + c(0, 40, 50, 60, 70)) aggregate(z, as.yearmon, FUN = mean, na.rm = TRUE) On my Windows system this R code sets dates and times to English: Sys.setlocale("LC_TIME", "English") -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ 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.