x is the name of a R dataset.
write.xlsx(x, "temp.xlsx", sheetName="merged data",
col.names=TRUE, row.names=TRUE, append=FALSE)
I got this advice from someone when I needed to know how to apply a procedure on a subgroup of subjects within the analysis dataset. Thanks.
ols_result <- data %>% dplyr::filter(year=1) %>% lm(y~x,.) summary(ols_result)
I'm learning how to run multilevel models in R.
I tried the analysis of variance model, AKA, the intercept-only model.
I run this in SAS and get the same results. I didn't get the same degree of freedom.
proc glimmix data=sashlm.core_2014_4_years;
model post_test=/solution ddfm=kr dist=normal link=identity;
random intercept /subject=school;
In R, you can set a working directory in this way (I use C:/temp as an example).
If this generates an error message. suspect that you used a wrong quotation mark (this can happen when you copy and paste an example from the Internet). Just retype using '. You can read more about it here.
You also need to be careful about the slash. Microsoft Windows uses backward slashes, "\", to indicate the folder structure. R uses forward slash, "/" at least on my machine. This may be OS-dependent, so to really determine which slash is used on your environment, try this command to know the currently working directory and see which is used:
I got this on my personal PC ("/" is used).
Alternatively, go to File and click on Change dir... to specify the working directly. (I don't see this option in R-Studio), so this must be specific to the regular version of R).