Hello
I am using R 2.2.0 with Windows XP.
I've got a five element list object, each element containing two 
dataframes of equivalent size.

 > str(mylist)
List of 1
 $ data1:List of 2
  ..$ data1a       :`data.frame':    77 obs. of  63 variables:
  .. ..$ var1    : num [1:77] 0.41375 0.00056 1.43040 1.43528 0.61730 ...
  .. ..$ var2    : num [1:77] 1.154 1.686 0.673 0.800 0.760 ...
  .. ..$ var3    : num [1:77] 1.245 0.575 0.934 0.461 0.757 ...
    .
    .
    .
  ..$ data1b      :`data.frame':    77 obs. of  63 variables:
  .. ..$ var1    : num [1:77] 1284.59    7.59    1.16    8.66 2646.38 ...
  .. ..$ var2    : num [1:77] 1.231 1.129 0.427 1.132 0.692 ...
  .. ..$ var3    : num [1:77] 1.36 0.68 1.39 2.54 1.39 ...
    .
    .
    .
 $ data2:List of 2
  ..$ data2a       :`data.frame':    77 obs. of  63 variables:
  .. ..$ var1    : num [1:77] 0.41375 0.00056 1.43040 1.43528 0.61730 ...
  .. ..$ var2    : num [1:77] 1.154 1.686 0.673 0.800 0.760 ...
  .. ..$ var3    : num [1:77] 1.245 0.575 0.934 0.461 0.757 ...
    .
    .
    .
  ..$ data2b       :`data.frame':    77 obs. of  63 variables:
  .. ..$ var1    : num [1:77] 1284.59    7.59    1.16    8.66 2646.38 ...
  .. ..$ var2    : num [1:77] 1.231 1.129 0.427 1.132 0.692 ...
  .. ..$ var3    : num [1:77] 1.36 0.68 1.39 2.54 1.39 ...
     .
    .
    .

My goal is to do calculations with corresponding variables (e.g. 
correlation between var1 of data1a and var1 of data1b) within each list 
element.
I tried to do it with lapply(data, myfunction,...), but I dont know if 
theres a way to index the two vars within lapply.
There is certainly a way to do it by looping, but lapply is much more 
elegant.

Thank you for your help.
Christian

-- 
Christian Bieli, project assistant
Institute of Social and Preventive Medicine
University of Basel, Switzerland
Steinengraben 49
CH-4051 Basel
Tel.: +41 61 270 22 12
Fax:  +41 61 270 22 25
christian.bieli@unibas.ch
www.unibas.ch/ispmbs


	[[alternative HTML version deleted]]


