我有以下代码:
PIBTOTALnominal<-c(13556.76, 15255.59, 16658.13, 18558.56, 20112.05, 21722.82, 21045.36, 23300.21, 25648.44, 27737.39, 28277.22)
length(PIBTOTALnominal)
mean(PIBTOTALnominal)
sd(PIBTOTALnominal)
limclase=seq(min(PIBTOTALnominal),max(PIBTOTALnominal),length=9)
hdatos=hist(PIBTOTALnominal,breaks=limclase,plot=FALSE)
hdatos
interv=hdatos$mids[2]-hdatos$mids[1]
ejex=c(hdatos$breaks[1]-interv, hdatos$breaks, max(hdatos$breaks)+interv)
ejelimx=c(hdatos$breaks[1]-interv,max(hdatos$breaks)+interv)
ejelimy=c(0,max(hdatos$counts)+3)
histo<-hist(PIBTOTALnominal,main="Masa de filtros",ylab="Frecuencia", xlab="m (mg)",
labels=TRUE,breaks=limclase, xlim=ejelimx, xaxt="n", ylim=ejelimy, col="gray")
axis(side=1, at=ejex)
但是当我使用knitr
生成pdf文件时,我收到以下错误:
Error in axis(side = 1, at = ejex) : plot.new has not been called yet
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> axis
Execution halted
我犯了什么错误?