Created
March 20, 2021 05:33
-
-
Save jcheong0428/22bfe8767c5a76b4af1f428c68fa53b5 to your computer and use it in GitHub Desktop.
Manipulating data in R from rpy2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%R -i data | |
# Specify Evit as a factor and set a polynomial contrast. | |
data$Evit <- as.factor(data$Evit) | |
contrasts(data$Evit) <- contr.poly | |
m<-lmer('Weight ~ Time * Evit + (1|Pig)', data=data) | |
print(summary(m)) | |
# Relevel categorical data so base level is Evit100 | |
m<-lmer('Weight ~ Time * relevel(Evit, ref="Evit100") + (1|Pig)', data=data) | |
print(summary(m)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment