Cannot find a variable for plotting

I am using the same data with the same column variable names to make two different graphs grouped in different ways. The first graph I made was a histogram using the following code:

Level_of_Change_Histogram <- ggplot(data=VAS_DATA, mapping=aes(x=level_change, fill=Condition))+
geom_histogram(position = "identity", alpha=.4,bins=10, binwidth=1,color = "black")+
labs(title='Frequency of VAS Response Changes in MS versus HC', x= 'Level of Change', y='Frequency of Change')+
scale_y_continuous(breaks = seq(0, 100, by = 5), expand=c(0,0))+
theme(plot.title = element_text(hjust = 0.5),legend.position = c(0.9, 0.9),
legend.key.size=unit(1, 'cm'))+
expand_limits(y=85, x=-10)

This graph came out how I liked. I tried using the same data to create a boxplot grouped differently using this code:

##longitudinal boxplot
Level_of_Change_Boxplot_Over_time<- ggplot(data=VAS_DATA,

However, when I try to do this, it says this:
Error in FUN(X[[i]], ...) : object 'level_change' not found

I realize the in the second graph I try to use level_change in the y variable and not x, but I have used level_change in the y variable earlier last week and it was fine so I do not think that is the problem. level_change exists in the VAS_DATA so i do not know why it is unable to find it? Thank you!

Hi, can you provide a reproducible example of VAS_DATA?

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.