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 REPR oducible EX ample (reprex) illustrating your issue.
This was the problem, thank you for your help, it works now.
system
Closed
June 10, 2022, 6:55am
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.