Displaying 2 results from an estimated 2 matches for "var50".
Did you mean:
var0
2006 Feb 03
1
Using string vectors as for loop arguments
Is there a mechanism to interate through a vector of strings? Say I
have a data frame of 50 variables (VAR1 to VAR50), each with 100
measurements along with some coding factors (EXP and DOSE). I want to
calculate the mean of a subset of each of VAR1 to VAR 50 (selecting
by EXP and DOSE). Rather than just copy/pasting the same code 50
times, I thought of using a for loop to go through a vector of VAR1
to...
2008 May 30
0
imputationlist, update, and recode
...putation runs just fine, as does the
reading of the mi data sets into an imputationList. I run into trouble,
though, when I try to construct a scale across all the data sets. Is there
a simple way to do this?
(here's what I've been trying)
vars_to_impute = c("var1", ... "var50")
imputed <- amelia(data=vars_to_impute, m=5, outname="miset")
files.allmisets <- list.files(getwd(),pattern="miset*",full=TRUE)
allmis <- imputationList(lapply(files.allmisets, read.csv))
scale1_vars <- c("var1", "var2", "var3", ....