David Paul
2012-May-31 03:20 UTC
[R] transcan() imputation of categorical (factor) variables
Hi, and thanks in advance. I have used the following to try to obtain singly-imputed values for missing data comprising no more than 15% of any variable in the data:> library(Hmisc) > some.df = read.csv("N:/.../some.csv", header = TRUE, stringsAsFactors = TRUE) > some.trans <- transcan(~ contin.var1 + contin.var2 + categ.var1 + categ.var2, > categorical =c("categ.var1","categ.var2"), > transformed = TRUE, > imputed = TRUE, > impcat = "score", > data = some.df, > iter.max = 100, > shrink = TRUE, > method = "canonical" > ) > attach(some.df,pos=1) > some.df.imputed <- impute(some.trans)It seems to run, but the object "some.df.imputed" isn't a dataframe, and R issues the message> Imputed missing values with the following frequencies > and stored them in variables with their original names: > > contin.var1 contin.var2 > 13 9which seems to imply that the categorical variables were not imputed. What I want, simply put, is a dataframe with imputed values for both the continuous and categorical variables. I'm sure I'm doing something silly. Any help would be greatly appreciated. Thanks, David ________________________________ This message contains information which may be confident...{{dropped:11}}