Hi,

I am quite new to R and in need of some advice. I am trying to conduct a meta regression over a some studies with about 7 mod variables which I have to dummy encode.

I have found the following piece of code in the manual for the metafor library:

### manual dummy coding of the allocation factor
alloc.random <- ifelse(dat$alloc == "random", 1, 0)
alloc.alternate <- ifelse(dat$alloc == "alternate", 1, 0)
alloc.systematic <- ifelse(dat$alloc == "systematic", 1, 0)

### test the allocation factor (in the presence of the other moderators)
### note: "alternate" is the reference level of the allocation factor
### note: the intercept is the first coefficient, so btt=c(2,3)
rma(yi, vi, mods=cbind(alloc.random, alloc.systematic, year, ablat), data=dat, method="REML", btt=c(2,3))

What I do not understand is the following: 
How does R know which columns in my data.frame are related to the dummy encoded variables?

It is clear that in the call of cbind I just do not use the reference variable as a parameter but I do not get it how R knows that alloc.random and alloc.systematic refer to the column alloc in the data frame.

Thank you very much in advance for your help,


kind regards, 
Alma
	[[alternative HTML version deleted]]

