Re: [R] Using lapply when there are dependencies

2015-05-28 Thread blue honour via R-help
Winsemius wrote: Subject: Re: [R] Using lapply when there are dependencies Cc: r-help@r-project.org Date: Thursday, May 28, 2015, 7:02 AM On May 27, 2015, at 4:34 PM, blue honour via R-help wrote: > Hi all, > > Let's say I have a vector: > > vv<-c(1,2,3) &

[R] Using lapply when there are dependencies

2015-05-27 Thread blue honour via R-help
Hi all, Let's say I have a vector: vv<-c(1,2,3) And suppose I have a function f(a,b), which is a function of 2 scalar inputs. I would like to evaluate this function separately for each element of the vv vector while the second input to f( ) will be the previous output from f( ). So, the valu

[R] Retrieving data from nested lists

2015-05-26 Thread blue honour via R-help
Dear R users, I have a question regarding retrieving data from nested lists. To illustrate, here is an example input: d1<-data.table(v1=c(3,4),v2=c(2,5)) d2<-data.table(v1=c(1,2),v2=c(1,1))l1<-list(d1,name="test")l2<-list(d2,name="test2")motherlist<-list()motherlist$l1<-l1motherlist$l2<-l2 Let's s