If I have a dataset wherein one column is a list, how can I run linear regression including only specific variables in that column?
Example.Column <- (DrugA1, Drug A2, DrugA2, DrugA3, DrugB1, DrugB2,
DrugB3, No.Drug, Drug A2, No.Drug, DrugB3)
VolMeasure <- c("VL.of.region1", "VL.of.region2", "VL.of.region3")
Sorry for the confusion here - there would be a for-loop to have the lm
go through each VolMeasure
for the response variable - so there would be 3 regressions in the example.
Example.lm <- lm(VolMeasure ~ DrugA1|DrugA2|DrugA3, data=dataset)
From this, I need to also figure out how I can do such a thing for multiple variables in one linear regression, so for example if I add a dieting variable
Diet.variable<-("Atkins", "Mediterranean", "Caloric Restriction", "None")
Example2.lm<-lm(VolMeasure ~ DrugA1|DrugA2|DrugA3 & Diet.variable=c("Atkins"), data=dataset)