Niklas Fischer
2012-Jul-17 05:43 UTC
[R] converting list/data.frame to mids/mi object (multiple imputation)
Dear R Users, After imputation, I've created latent variable, but couldn't convert it back to mids object. Do you have any suggestion how to convert data.frame/list to mids(for mice) or mi(for mi pakcage) Any help is appreciated. Niklas [[alternative HTML version deleted]]
Hi, How do I use the subset function without losing the attributes? For example, test.df <- data.frame(a = rnorm(100), b = runif(100), c = rexp(100)) attr(test.df[, 1], "units") <- c("cm") attr(test.df[, 2], "units") <- c("kg") attr(test.df[, 3], "units") <- c("ha") ## We want this behavior str(test.df[, "a", drop = FALSE]) ## But not the behavior of subset str(subset(test.df, select = a, drop = FALSE)) ## Whic is equivalent to str(test.df[TRUE, "a", drop = FALSE]) Cheers, M