Displaying 1 result from an estimated 1 matches for "newmeans_".
2012 Jun 20
2
Using object as literal value in list vector
...ector of strings to name a number of list elements. For instance
#Create vector of strings
Et<- c("ACC","RTL","WHL")
MeanValues_ <- list("ACC" = 1000, "RTL" = 2000, "WHL" = 3000)
#Iterate through each element of vector
NewMeans_ <- list()
for(et in Et){
NewMeans_ <- c(NewMeans_,list(et = unlist(MeanValues_[et]) * .80 ))
}
Returns
> NewMeans_
$et
ACC
800
$et
RTL
1600
$et
WHL
2400
But I want 'et' to be the object value of et, so it would be $ACC, $RTL, and
$WHL. I realize there may be anoth...