Hello, I have a written a couple of functions (states.trends(.) and trend.generator(.)) to create monthly aggregated time series from disaggregated data. They seem to work pretty fine with all the data I provide, but they give me the following error in one the case I use a particular table (per.after.sub):
> states.trends(per.after.sub,'CUST_SINCE') Error in if (d.length%%d.length2 != 0) { : missing value where TRUE/FALSE needed > traceback() 5: update.POSIXct(x, mdays = 1, hours = 0, minutes = 0, seconds = 0) 4: update(x, mdays = 1, hours = 0, minutes = 0, seconds = 0) 3: floor_date(x[[w]], "month") at #15 2: trend.generator(x, "STATE", vec.states[i, 1], y) at #4 1: states.trends(per.after.sub, "CUST_SINCE") I use several tables: 1) full1, which contains data from 2009 to 2012 2) per2012.sub, which is a subset of full1 based on the criterion: { date_per = '2012-01-01' date_per = as.POSIXct(date_per,tz='', "%Y-%m-%d") per2012.sub = subset(full1, CUST_SINCE >= date_per) } 3) per.after.sub, which is a subset of full1 based on the criterion: { date_per1 = '2012-08-01' date_per1 = as.POSIXct(date_per1,tz='',"%Y-%m-%d") per.after.sub = subset(full1, CUST_SINCE >= date_per1) } All the procedures works fine with the tables 'full1' and 'per2012.sub' but it gives me the error when using the table 'per.after.sub'. What has this data set different from the other two ? Can you help me ? Where can the error be ? Thank you Edoardo [[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.