문제

I am new to R programming and I would like to make a histogram about sex and the correspondent jobs.

The problem I have is that I can't add a legend in the diagram.

Also, I would like on the top of every bar to add the frequency number.

Could you help me please ?

library(lattice)
histogram(~ job | sex, col=rainbow(7), main="", xlab = "", ylab="(%)")

P.S. I am trying with legend function but I get this error:

Error in strwidth(legend, units = "user", cex = cex) : plot.new has not been called yet

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top