Calculate prevelance rates using R

Hi, welcome to the forum. Astute advisors know when to disappear.!

The answer to your question probably depends on your data layout. Could you supply some sample data? A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where wydata is the name of your data.frame or tibble, etc., and paste the output here.

You may also find FAQ: How to do a minimal reproducible example ( reprex ) for beginners or FAQ: Tips for writing R-related questions
helpful.