last day of month values
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Joerg, thank you for the answer, however I have the timestamp in format 26-02-02. Do I have to extract each part of the date? Thank you. lukas
On Tue, 26 Feb 2002, Joerg Maeder wrote:
Hallo Lukas, try this code #data d <- data.frame(day=c(1,10,15,30,2,16,18,28),month=c(1,1,1,1,2,2,2,2),value=c(8,9,7,5,6,4,1,2)) #find the highest day per month ma <- tapply(d$day,d$month,max) #get them values d$value[match(as.numeric(names(ma))+(ma-1)/31,d$month+(d$day-1)/31)] gruess joerg Lukas Kubin wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have a stock market trading values time series. What's the best way to extract the "last day of month" values. I looked at function window() but doesn't appear suitable for this since it expects regular dates. Thank you. lukas - -- Lukas Kubin lukas.kubin at permonik.com phone: 00420603836180 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.5 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8e2w74TIZ2lmUAtsRAj/SAJ4heMKveDwpCLPwnnJTBnAvCSIRrQCeJTHi YEujkKsmoX/orLUlnHxBNYA= =H9uw -----END PGP SIGNATURE----- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
- -- Lukas Kubin lukas.kubin at permonik.com phone: 00420603836180 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.5 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8e5uJ4TIZ2lmUAtsRAuQXAKDCaNnEyXXVFa6fMS81klJIXDFrlgCgmm71 zVnHeNICrNs6dvQd0Ir1YkI= =pcXi -----END PGP SIGNATURE----- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._