Displaying 1 result from an estimated 1 matches for "meanvalues_".
2012 Jun 20
2
Using object as literal value in list vector
...a pretty simple question I think but cannot find an answer on the
list or in my brain. I would like to iterate through a loop and use a
vector 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
$...