質問

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