[R] Calling Dynamic Variables names

santoshdvn santoshdvn at gmail.com
Thu Mar 29 10:31:09 CEST 2012


HI,

Need help in calling the dynamic variables 

I have 2 datasets . FIrst one(mdata) is having the metadata and second
one(dataset) has got the data. 

sample 
*mdata *
Variable (header)

attribute1
attribute2
attribute3
attribute4

*dataset *

attribute1     attribute2     attribute3    attribute4  

1                             3                    34               12
3                             45                  1                  09
34                           22                  12               12
56                           6                     16              77
......................
so i have written a forloop 


code :  i want to find the mean for each attribites

for( i in mdata$vairable)
{
  print (mean(dataset$i)    # wants to call i value
}


please help in regard.

THanks,
Santosh

--
View this message in context: http://r.789695.n4.nabble.com/Calling-Dynamic-Variables-names-tp4514820p4514820.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list