0
energia <- data.frame("curso" = 1:15,"enem"=1:5)
energia$curso <- c("Eng Aeroespacial", "Eng Ambiental", "Eng de Controle e Automação", "Eng de Minas", "Eng de Produção", "Eng de Sistemas", "Eng Mecânica", "Eng Metalurgica", "Geologia", "Licenciatura em Matemática","Matemática","Química","Sistema de Informação")
energia$enem <- c(1, 2, 3, 4, 5)
rotulo <- c("curso, quantidade que fez enem")
par(mgp=c(1,1,0))
barplot(energia$enem, main="enem por curso", xlab=rotulo[1],ylab=rotulo[2], names.arg = energia$curso, ylim=c(0, 100), cex.names = 0.8, xaxs = "i")
barplot(energia$curso, xlab=rotulo[1], ylab=rotulo[2], names.arg = energia$curso, ylim=c(0, 100), cex.names = 0.8, xaxs = "i", add=TRUE)
#Error in `$<-.data.frame`(`*tmp*`, curso, value = c("Eng Aeroespacial", :
#replacement has 13 rows, data has 15
Your data frame
energia
and the lines you create after don’t have the same amount of lines. And it’s good to post the error messages along with the questions.– Jorge Mendes
enem
with exactly the same values? 3) Whyylim=c(0, 145000)
(one hundred and forty-five thousand!!!) whenmax(energia$enem) == 5
andmax(energia$curso) == 15
? 4) Why have thegrid
above the bars ofenem
and below those ofcurso
?– Rui Barradas
I’m trying to compare how many times each course the Enem but other than the error of the lines I fixed with tips those of the line that not but graph was not as I expected how to do please help me
– Joao Victor
The problem, as pointed out by Jorgemendes, is in the second line and relates to the fact that in a
data.frame
all the columns must have the same size. As the first one has 15 column elementscurso
should also have, but has only 13 values.– Tomás Barcellos