To add more clarity to my question My data pp2 is a list
(pp2[[1]]) RIC Trade.Date Close.Price Currency.Code Convertion.Rate New.Price ABCD.SZ 2008/02/29 15.30 CNY 0.1408 2.154240 ABCD.SZ 2008/01/31 15.27 CNY 0.1392 2.040048 ABCD.SZ 2007/11/30 11.07 CNY 0.1357 1.502199 ABCD.SZ 2007/10/31 10.89 CNY 0.1340 1.459260 ABCD.SZ 2007/09/28 12.77 CNY 0.1334 1.703518 (pp2[[2]]) RIC Trade.Date Close.Price Currency.Code Convertion.Rate New.Price PQRS.SZ 2008/02/29 9.27 CNY 0.1408 1.305216 PQRS.SZ 2008/01/31 8.07 CNY 0.1392 1.123344 PQRS.SZ 2007/12/31 8.76 CNY 0.1371 1.200996 PQRS.SZ 2007/11/30 6.43 CNY 0.1357 0.872551 PQRS.SZ 2007/10/31 6.80 CNY 0.1340 0.911200 PQRS.SZ 2007/09/28 7.94 CNY 0.1334 1.059196 And so on till (pp2[[1244]]) Each of pp2[[i]] is a data frame. For each date I need to find the range of New.Price across the list i.e.for 2008/02/29 it would be max(pp2[[i]]$New.Price[1])-min(pp2[[i]]$New.Price[1]) where i ranges from 1 to 1244 Thank you, Ravi -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2008 2:12 AM To: Ravi S. Shankar Subject: Re: [R] Range across a List >From: "Ravi S. Shankar" <[EMAIL PROTECTED]> >Date: 2008/03/26 Wed PM 03:28:52 CDT >To: [EMAIL PROTECTED] >Subject: [R] Range across a List i think it's a dataframe ( it looks like one ) or convert it to one if it's not and then I think below should work. temp<-lapply(split(pp2,pp2$Trade.Date), function(.df) { data.frame(.df$Trade.Date[1],range(.df$New.Price)) }) result<-do.call(rbind,temp) test it though because i didn't. >Hi R, >I have a list >> class(pp2) >[1] "list" > >> length(pp2) >[1] 1244 > >It is in the below format > RIC Trade.Date Close.Price Currency.Code Convertion.Rate New.Price >ABCD.SZ 2008/02/29 15.30 CNY 0.1408 2.154240 >ABCD.SZ 2008/01/31 15.27 CNY 0.1392 2.125584 >ABCD.SZ 2007/12/31 14.88 CNY 0.1371 2.040048 >ABCD.SZ 2007/11/30 11.07 CNY 0.1357 1.502199 >ABCD.SZ 2007/10/31 10.89 CNY 0.1340 1.459260 >ABCD.SZ 2007/09/28 12.77 CNY 0.1334 1.703518 > >I want to find the range of pp2$New.Price for length(pp2) for each date >Any help would be appreciated > >Thanks in advance >Ravi > > >This e-mail may contain confidential and/or privileged i...{{dropped:10}} > >______________________________________________ >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. This e-mail may contain confidential and/or privileged i...{{dropped:10}} ______________________________________________ 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.