Hello, it wanted to know how I can extract of a dates frame the values peaks according to an interval that I establish. For example if dates are: 1 23 2 4 3 56 4 7 5 99 6 33 extract the date i wanted to divide into intervals of 2 an d to take alone the numbers 23, 56 and 99 of those 3 intervals. Thanks Ruben
Maybe, i can help (even when i'm not expert in R neither in english, just a beginner) But i use SPlus more then R, so i'm not sure if it works in R example:>dta<-c(23,4,56,7,99,33) >interv<-2 >steps<-seq(1,length(dta),interv) > dta[steps][1] 23 56 99 Regards Cristina Ortu?o Mojica Air Quality Monitoring Network in Mexico City metropolitan area Ministery of Environmental, Mexico City Tel. (+52) 55-52099903 xt. 6225 Fax. (+52) 55-55111460 Jalapa #15, 2nd floor Col Roma C.P. 06700 Mexico D. F. Our Internet URL: http://www.sma.df.gob.mx/ -----Mensaje original----- De: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch]En nombre de solares at unsl.edu.ar Enviado el: Mi?rcoles, 26 de Noviembre de 2003 16:09 Para: R-help at stat.math.ethz.ch Asunto: [R] multiple peaks in data frame Hello, it wanted to know how I can extract of a dates frame the values peaks according to an interval that I establish. For example if dates are: 1 23 2 4 3 56 4 7 5 99 6 33 extract the date i wanted to divide into intervals of 2 an d to take alone the numbers 23, 56 and 99 of those 3 intervals. Thanks Ruben ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Not entirely sure what you need. This gives data greater than a certain level: z <- c(23,4,56,7,99) z[z>20] or z[z>=median(z)] This extracts points that are larger than the ones on either side: zz <- c(-Inf,z,-Inf) z[diff(sign(diff(zz)))<0] --- Date: Wed, 26 Nov 2003 19:08:50 -0300 (ART) From: <solares at unsl.edu.ar> To: <R-help at stat.math.ethz.ch> Subject: [R] multiple peaks in data frame Hello, it wanted to know how I can extract of a dates frame the values peaks according to an interval that I establish. For example if dates are: 1 23 2 4 3 56 4 7 5 99 6 33 extract the date i wanted to divide into intervals of 2 an d to take alone the numbers 23, 56 and 99 of those 3 intervals. Thanks Ruben
I don't quite understand your English, but I'll take a stab at answering your question. If by "date" you mean "data" and by "peaks" "maxima," then df <- data.frame(V1=c(23, 4, 56, 7, 99, 33)) interval <- 2 if (nrow(df) %% interval == 0) tapply(df$V1, rep(1:(nrow(df) / interval), each=interval), max) might be what you need. Mark Wilkinson Informatics Analyst St. Jude Children's Research Hospital Department of Pharmaceutical Sciences The opinions expressed here are my own and do not necessarily represent those of St. Jude Children's Research Hospital. -----Original Message----- From: solares at unsl.edu.ar [mailto:solares at unsl.edu.ar] Sent: Wednesday, November 26, 2003 4:09 PM To: R-help at stat.math.ethz.ch Subject: [R] multiple peaks in data frame Hello, it wanted to know how I can extract of a dates frame the values peaks according to an interval that I establish. For example if dates are: 1 23 2 4 3 56 4 7 5 99 6 33 extract the date i wanted to divide into intervals of 2 an d to take alone the numbers 23, 56 and 99 of those 3 intervals. Thanks Ruben ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Here is a minor simplification of the last statement: df <- data.frame(V1=c(23, 4, 56, 7, 99, 33)) interval <- 2 if (nrow(df) %% interval == 0) apply(matrix(df$V1,interval),2,max) --- Date: Wed, 26 Nov 2003 17:30:15 -0600 From: Wilkinson, Mark <Mark.Wilkinson at stjude.org> To: <solares at unsl.edu.ar>, <R-help at stat.math.ethz.ch> Subject: RE: [R] multiple peaks in data frame I don't quite understand your English, but I'll take a stab at answering your question. If by "date" you mean "data" and by "peaks" "maxima," then df <- data.frame(V1=c(23, 4, 56, 7, 99, 33)) interval <- 2 if (nrow(df) %% interval == 0) tapply(df$V1, rep(1:(nrow(df) / interval), each=interval), max) might be what you need. Mark Wilkinson Informatics Analyst St. Jude Children's Research Hospital Department of Pharmaceutical Sciences The opinions expressed here are my own and do not necessarily represent those of St. Jude Children's Research Hospital. -----Original Message----- From: solares at unsl.edu.ar [mailto:solares at unsl.edu.ar] Sent: Wednesday, November 26, 2003 4:09 PM To: R-help at stat.math.ethz.ch Subject: [R] multiple peaks in data frame Hello, it wanted to know how I can extract of a dates frame the values peaks according to an interval that I establish. For example if dates are: 1 23 2 4 3 56 4 7 5 99 6 33 extract the date i wanted to divide into intervals of 2 an d to take alone the numbers 23, 56 and 99 of those 3 intervals. Thanks Ruben
Hello! why not try the R site search for "peaks": http://finzi.psych.upenn.edu/search.html which gives you (among other things): http://finzi.psych.upenn.edu/R/Rhelp02a/archive/7593.html Hope this helps, J. Joerg Rieckermann Environmental Engineering Swiss Federal Institute for Environmental Science and Technology (EAWAG)> -----Original Message----- > From: solares at unsl.edu.ar [mailto:solares at unsl.edu.ar] > Sent: Mittwoch, 26. November 2003 23:09 > To: R-help at stat.math.ethz.ch > Subject: [R] multiple peaks in data frame > > > Hello, it wanted to know how I can extract of a dates frame > the values > peaks according to an interval that I > establish. For example if dates are: > 1 23 > 2 4 > 3 56 > 4 7 > 5 99 > 6 33 > extract the date i wanted to divide into intervals of 2 an > d to take alone the numbers 23, 56 and 99 of those 3 > intervals. Thanks > Ruben > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo> /r-help >