I have a question regarding calling variables in svycontrast()
function with survey
package.
I'm trying to automate some contrast against a fixed parameter. I can do that no problem like this:
library(survey)
data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
diff <- svyby(~enroll, by = ~cnum, dclus1, na.rm.all = FALSE, svymean, covmat = T, vartype = "se")
parameter <- 550
svycontrast(diff, quote(`1` - parameter))
# nlcon SE
# contrast 2.8182 0
However, I have been for hours trying to figure out how to call that rowname
`1`, but with different approaches I keep getting mostly the following error message:
row <- quote(1)
svycontrast(diff, quote(row - parameter))
Error in row - parameter : non-numeric argument to binary operator
Any help would be very much appreciated.