Hi Elysa,
This is pretty much a guess. If you understand the first error, i.e.
that there are nine rows in your input data frame (?) that contain NA,
NaN, or Inf values, have you tried manually removing those rows and
feeding the remainder to your code?
Jim
On Sun, Oct 2, 2016 at 7:19 PM, Elysa Mitova <elysa.mitova at gmail.com>
wrote:> 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 at 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.