I'm trying to plot a simple boxplot where I get 15 boxplots for respondents age of 15 "Cadernos" (15 surveys, surveys A, B, C .. to O). But that's not working as expected. I have already tried to switch places to the "Cadernos" (surveys) and "Idade" (age) variables. Any idea? What I expected was 15 boxplots in the vertical axis.
The code I'm using is the follow:
library(ggplot2)
select_base %>%
ggplot(aes(Idade,Caderno)) +
geom_boxplot()
the plot I get is the following:


Idadeis a variable of type character or factor, instead of numeric. What doesstr(select_base)show you?str(select_base)returns: 'data.frame': 2876 obs. of 2 variables: $ Caderno: chr "N" "N" "M" "M" ... $ Idade : chr "15" "15" "15" "15" ... So, yes, they're characters, would that be affecting the code? Tks in advanceas.numeric(), but it's better to figure out why R read it in as a character in the first place - for example, does the data file contain something other than numbers in that column.