The presence of missings in the variable weight of a complex sampling is preventing R to calculate the mean. I initially tried na.rm = TRUE
, but it did not work, here is the excerpt:
svymean(basedados$variavel , svydesign( id = basedados$estrato , weight =
basedados$peso ),na.rm=TRUE)
Error in na.weight (data.frame (weights)): missing values in 'weights'
I also tested this version and nothing:
svymean(dp$Dcoracao , svydesign( id = dp$V0024 , weight = dp$teste , na.rm = TRUE
),na.rm=TRUE)
Error in na.weight (data.frame (weights)): missing values in 'weights'
Then another way was suggested, which shows another error message, as follows:
svymean(bd$Dcoracao , svydesign(id = bd[which(!is.na(bd$teste)),"V0024"], weight =
bd[which(!is.na(bd$teste)),"teste"]))
Error in tapply (1: NROW (x), list (factor (strata)), function (index) {: arguments must have same length
Additionally: Missed warning messages: