I met a strange problem that I cannot fully understand. I have to add a normal distribution line on the histogram. I entered every step of the code, but after entering the lines the function did not answer there. I do not know what happened. Hope someone helps me! MY code:
grades<-mydata$Exam1 hist(grades,breaks=20,freq=T) #A correct histogram comes out. mean(grades,na.rm=T) #there is NA in the column so I remove it when calculating mean. [1] 75.15278 sd(grades,na.rm=T) [1] 16.97443 x<-seq(0,100,0.01) y<-dnorm(x,mean=mean(grades,na.rm=T),sd=sd(grades,na.rm=T)) lines(x,y)#and there no response!no line showed up!
Is there something wrong with my code? Thank you for your help!
zhang525986
source share