Hi, May be this helps: #Creating some dummy data.? set.seed(24) lst1<-lapply(1:8,function(x) ts(sample(1:25,20,replace=TRUE))) set.seed(49) lst2<-lapply(1:8,function(x) ts(sample(1:45,20,replace=TRUE))) ??Find_Max_CCF() #No vignettes or demos or help files found with alias or concept or #title matching ?Find_Max_CCF? using regular expression matching. Found a function with the same name from r.789695.n4.nabble.com/ccf-function-td2288257.html ?capture.output(do.call(rbind,lapply(seq_along(lst1),function(i) Find_Max_CCF(lst1[[i]],lst2[[i]]))),file="output.txt") #output.txt #???????? cor lag #10 0.4799088? -1 #17 0.2060688?? 6 #16 0.3716986?? 5 #6? 0.3701101? -5 #8? 0.3964724? -3 #4? 0.2942228? -7 #15 0.3191763?? 4 #9? 0.3654471? -2 A.K. capture.output(do.call(rbind,lapply(seq_along(lst1),function(i) Find_Max_CCF(lst1[[i]],lst2[[i]])))) #[1] "???????? cor lag" "10 0.4799088? -1" "17 0.2060688?? 6" "16 0.3716986?? 5" #[5] "6? 0.3701101? -5" "8? 0.3964724? -3" "4? 0.2942228? -7" "15 0.3191763?? 4" #[9] "9? 0.3654471? -2" Hi, I am using following code to Find lag at which cross correlation is maximum ccf( ), where Find_Max_CCF(x,y) returns the max cross correlation. where x[i], y[i] are two different time series, i=1,2 ,...,8 for( i in 1:8) { {c=Find_Max_CCF ( x [ i ], y [ i ] ) ) } Now, I want to capture the whole 8 results in the same excel sheet. I used capture.output(Find_Max_CCF ( x [ i ], y [ i ] ) ), file="output.txt") But this is giving me only the last result that is cross correlation for last two time series, x[8], y[8]. Please help... Thanks in advance.. Shilpa Rai
Thank yos so much....It helped a lot :) On Sun, Aug 25, 2013 at 8:18 AM, arun kirshna [via R] < ml-node+s789695n4674468h82@n4.nabble.com> wrote:> Hi, > > May be this helps: > #Creating some dummy data. > > set.seed(24) > lst1<-lapply(1:8,function(x) ts(sample(1:25,20,replace=TRUE))) > set.seed(49) > lst2<-lapply(1:8,function(x) ts(sample(1:45,20,replace=TRUE))) > > > ??Find_Max_CCF() > #No vignettes or demos or help files found with alias or concept or > #title matching ‘Find_Max_CCF’ using regular expression matching. > > > Found a function with the same name from > > r.789695.n4.nabble.com/ccf-function-td2288257.html > capture.output(do.call(rbind,lapply(seq_along(lst1),function(i) > Find_Max_CCF(lst1[[i]],lst2[[i]]))),file="output.txt") > > > #output.txt > # cor lag > #10 0.4799088 -1 > #17 0.2060688 6 > #16 0.3716986 5 > #6 0.3701101 -5 > #8 0.3964724 -3 > #4 0.2942228 -7 > #15 0.3191763 4 > #9 0.3654471 -2 > > A.K. > > > > > > capture.output(do.call(rbind,lapply(seq_along(lst1),function(i) > Find_Max_CCF(lst1[[i]],lst2[[i]])))) > #[1] " cor lag" "10 0.4799088 -1" "17 0.2060688 6" "16 > 0.3716986 5" > #[5] "6 0.3701101 -5" "8 0.3964724 -3" "4 0.2942228 -7" "15 > 0.3191763 4" > #[9] "9 0.3654471 -2" > > > > > > Hi, > I am using following code to Find lag at which cross correlation is > maximum ccf( ), where Find_Max_CCF(x,y) > returns the max cross correlation. where x[i], y[i] are two different time > series, i=1,2 ,...,8 > > for( i in 1:8) > { > {c=Find_Max_CCF ( x [ i ], y [ i ] ) ) > } > > Now, I want to capture the whole 8 results in the same excel sheet. I used > capture.output(Find_Max_CCF ( x [ i ], y [ i ] ) ), file="output.txt") > > But this is giving me only the last result that is cross correlation for > last two time series, x[8], y[8]. > Please help... > > Thanks in advance.. > > Shilpa Rai > > ______________________________________________ > [hidden email] <user/SendEmail.jtp?type=node&node=4674468&i=0>mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > r.789695.n4.nabble.com/Capturing-the-whole-output-using-R-tp4674456p4674468.html > To unsubscribe from Capturing the whole output using R, click here<r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4674456&code=cmFpc2hpbHBhLmJodUBnbWFpbC5jb218NDY3NDQ1NnwxOTAyOTIzNTU5> > . > NAML<r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html!nabble:email.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers!nabble:email.naml-instant_emails!nabble:email.naml-send_instant_email!nabble:email.naml> >-- Shilpa Rai MSc.(2011-2013) Applied Statistics and Informatics Indian Institute of Technology,Bombay -- View this message in context: r.789695.n4.nabble.com/Capturing-the-whole-output-using-R-tp4674456p4674483.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]