I would like to use aggregate.ts() and apply() on circular data, but I can't figure out how to get the circular data components to pass through:
library(circular) x <- circular(c(20, 30, 355, 5, 345, 25), units = "degrees") % I want to get the mean angle for each successive pair; answer should be c(25, 0, 5): aggregate.ts(x, ndeltat=2, FUN="mean.circular") Error in as.circular(x) : (converted from warning) an object is coerced to the class 'circular' using default value for the following components: type: 'angles' units: 'radians' template: 'none' modulo: 'asis' zero: 0 rotation: 'counter' conversion.circularxradians0counter % Using mean() disregards the circular nature of the data: aggregate.ts(x, ndeltat=2, FUN="mean") Time Series: Start = 1 End = 5 Frequency = 0.5 [1] 25 180 185 % I have similar problems with apply(): y <- matrix(x, ncol=2, byrow=T) % Both of the following expressions yield the same error message as above. apply(y, 1, FUN="mean.circular") apply(circular(y, units = "degrees"), 1, FUN="mean.circular") I've tried passing various additional arguments to aggregate.ts() and apply() to specify the circular components, without success. Scott Waichler Pacific Northwest National Laboratory [EMAIL PROTECTED] ______________________________________________ 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.