Entering edit mode
23 months ago
Curious_Gene
▴
10
I understand that it is possible to specify variables as fixed effects in R for building a model matrix, for example:
model.matrix(~age-category, data = sample_table)
Is it possible to do the same but with random effects? I want to specify a column called "subject_ID" for a paired analysis as a random effect, but it is currently a factor. The below command throws an error:
model.matrix(~(1 | subject_ID), data = sample_table)
Error in 1 | subject :
operations are possible only for numeric, logical or complex types
Is this the right approach? Are there functions other than model.matrix()
that can be used to achieve this? For context, I'm trying to build the model matrix before I run SNM for the normalization of expression data. Appreciate any help!
I am facing the same error.. Have you figured it out?