Unexpected symbol with code

Hi, I am trying to put this code into R, but it keeps telling me I have an "unexpected symbol."


Error: unexpected symbol in "phenoData<-read.csv("pheno.txt",header=TRUE,sep="\t")design"

Try it this way

phenoData <- read.csv("pheno.txt", header=TRUE, sep="\t")

design <- model.matrix(~diagnosis, phenoData)

fit <- lmFit(eset, design)


Yes I tried it this way as well but got the following error.

design <- model.matrix(~diagnosis, phenoData)
Error in eval(predvars, data, env) : object 'diagnosis' not found


To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Thank you for the help!

I realized I specified the data in the txt file as something other than "diagnosis", which is why it was unrecognizable.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.