I'm trying to plot a graph on the interaction between two variables on repeated measures.
I installed tidyverse packages and loaded - GGplot-2.
I brought the data in and used this code:
data$Block<- as.factor(data$Block)
data$Seq_Type<-factor(data$Seq_Type, c(soc, moc))
but then this gives an error object 'soc' not found.
Error in factor(data$Seq_Type, c(soc, moc)) : object 'soc' not found
data$Seq_Type<-factor(data$Seq_Type, c(soc, moc))
I have both soc and moc variables in the column. I wonder why 'soc' is not found.
if soc is in a data.frame then you wouldnt normally access it without a prexif / as if it was in global environment (because it isnt) perhaps data$soc would be appropriate. Its hard to advise you as you have not provided sufficient context...
If you would like help of greater quality then please consider providing a reprex.
Factor levels must be specified as a character vector (quoted values), so I think the code should be
data$Seq_Type <- factor(data$Seq_Type, c('soc', 'moc'))
If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.
This was the problem, thank you for your help, it works now.