Sidenote:
When you do imputation in this way all your inference (error
estimates, goodness of fit, confidence intervals, etc.) will be wrong
and misleading, as you are creating "information" from nothing.
If this comment is irrelevant, please ignore.
Cheers,
Bert
Bert Gunter
"The trouble with h
Maybe you can use something like this
In this way, almost your proportion of 0, 1 and 2 will be maintained
m <- matrix(sample(c(NA, 0:2), size = 50*100, replace = TRUE), nrow = 50,
ncol = 100)
trunc(prop.table(apply(m, 2, table), 2) * colSums(is.na(m)), 0)
m[is.na(m)] <- unlist(apply(trunc(prop.t
Hello specialist,
I have a matrix in which there are NA,0,1 and 2 in each columns.
I wanna replace NAs with special proportion of 0,1 or 2 !
for example in df<- matric(df, nrow=50, ncol=100)
If in one column the number of NAs = 10 , # of 0=50 , #of 1=25 and # of
2=15
I want to replace 5 of 10 N
3 matches
Mail list logo