Histogram using Sturges' bining

Hello,

I am trying to create a histogram using Sturges' bining rule, yet I keep
getting 2 errors, which probably have to do with the variable I am using.

Here is my process and the errors, what would you suggest?

k <- ggplot (world, aes (x=polstab))

wid <- ceiling ((max(world$polstab)- min (world$polstab))/
nclass.Sturges(world$polstab))

k + geom_histogram(col = "black", fill = "white", binwidth = wid)

Now, I get two error messages:

1: Removed 9 rows containing non-finite values (stat_bin).
2: Computation failed in `stat_bin()`:
missing value where TRUE/FALSE needed

The first one I understand, the second one is more problematic. What could
I do to remove this error?



Thank you in advance!

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to