J-PAL / bcstatsR

R version of the Stata command bcstats
MIT License
7 stars 6 forks source link

Adding multiple variables #13

Closed catherinecthomas closed 5 years ago

catherinecthomas commented 5 years ago

@vikjam Is there a way to add multiple Type 1/2/3 variables? In the examples I only see 1 variable for each, and I'm not sure what other type of object "t1vars" would take than individual variable names.

vikjam commented 5 years ago

Hi @catherinecthomas, I'll post an update tonight! Thanks for raising this issue.

catherinecthomas commented 5 years ago

@vikjam Thanks very much! Much appreciated that this package exists for R, and this functionality of having multiple of each variable type would make it even more useful.

vikjam commented 5 years ago

Hi @catherinecthomas, I fixed a bug that prevented a list of variables being provided as an argument for t1vars, t2vars, t3vars and updated the examples page. Thanks for raising this issue!

catherinecthomas commented 5 years ago

Hi @vikjam thank you for providing this update! I just tried to run it after reinstalling the bcstatsR package. I had a line t1vars = c("marital", "age"),... but got this error message: Error in aggregate.data.frame(as.data.frame(x), ...) : no rows to aggregate. Thoughts?

vikjam commented 5 years ago

Hi @catherinecthomas, could you try to run this example to see if it works for you?

library(bcstatsR)
data(survey, bc)

result.mv <- bcstats(surveydata  = survey,
                     bcdata      = bc,
                     id          = "id",
                     t1vars      = c("gender", "gameresult"),
                     t3vars      = "itemssold",
                     enumerator  = "enum",
                     enumteam    = "enumteam",
                     backchecker = "bcer",
                     exclude     = list(itemssold = c(0)))

Also, can you double-check the version is bcstatsR version 0.0.0.9010?

catherinecthomas commented 5 years ago

This works! Fantastic. Thanks so much!