0

I am referring to this post. I have applied the proposed code to my data that has a similar structure, and it works well without the margin specification for prop.table:

lapply(names(dat)[1:9], function(x) prop.table(
    svytable(bquote(~.(as.name(x)) + seg_2), dat_weight),
)*100)

However, when I add margin = 2 (as in the example), I get the following error:

Error in apply(x, margin, sum) : 'MARGIN' does not match dim(X)

I need the column wise proportions, but it gets messed up in the lapply call for a reason I don't know.

M--
  • 25,431
  • 8
  • 61
  • 93
karma
  • 1

0 Answers0