[R] Histogram using Sturges' Bining Errors

Elysa Mitova elysa.mitova at gmail.com
Sun Oct 2 10:19:58 CEST 2016

Histogram using Sturges' bining


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))/

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]]

More information about the R-help mailing list