Dear Listers I??ve been using ggmap package to produce crime Heat map. But I??ve noticed the following warning message when executing my code: In loop_apply(n, do.ply) : Removed 4945 rows containing non-finite values (stat_density2d). I??ve googled this message but I couldn??t find any good answers. Is this related to ggmap package or one of its depending package? What does it mean? Thanks! [[alternative HTML version deleted]]
Your data contains 4945 rows with missing or infinite values. These cannot be handled by stat_density2d and are dropped for that reason. Best regards, Thierry Op 1 jul. 2015 08:43 schreef "Chichi Shu" <chichi.shu at hotmail.com>:> Dear Listers > > > > I?ve been using ggmap package to produce crime Heat map. But I?ve noticed > the following warning message when executing my code: > > > > In loop_apply(n, do.ply) : > > Removed 4945 rows containing non-finite values (stat_density2d). > > > > I?ve googled this message but I couldn?t find any good answers. > > > > Is this related to ggmap package or one of its depending package? > > > > What does it mean? > > > > Thanks! > > [[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. >[[alternative HTML version deleted]]
Thanks Thierry. Is it the longitude and latitude that need to have finite
values?
From: Thierry Onkelinx
Sent: Wednesday, July 01, 2015 2:50 AM
To: Chichi Shu
Cc: r-help at r-project.org
Subject: Re: [R] ggmap warning
Your data contains 4945 rows with missing or infinite values. These cannot be
handled by stat_density2d and are dropped for that reason.
Best regards,
Thierry
Op 1 jul. 2015 08:43 schreef "Chichi Shu" <chichi.shu at
hotmail.com>:
Dear Listers
I?ve been using ggmap package to produce crime Heat map. But I?ve noticed the
following warning message when executing my code:
In loop_apply(n, do.ply) :
Removed 4945 rows containing non-finite values (stat_density2d).
I?ve googled this message but I couldn?t find any good answers.
Is this related to ggmap package or one of its depending package?
What does it mean?
Thanks!
[[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.
[[alternative HTML version deleted]]
Hi,
I limit my data to just two fields. Longitude and latitude. I first used
is.finite to check each of the long and lat values to make sure they are finite
values.
Then when I use ggmap again, it still tells me that it removed the majority of
the records bec of non-finite values.
Any other suggestions?
Thanks!
From: Thierry Onkelinx
Sent: Wednesday, July 01, 2015 2:50 AM
To: Chichi Shu
Cc: r-help at r-project.org
Subject: Re: [R] ggmap warning
Your data contains 4945 rows with missing or infinite values. These cannot be
handled by stat_density2d and are dropped for that reason.
Best regards,
Thierry
Op 1 jul. 2015 08:43 schreef "Chichi Shu" <chichi.shu at
hotmail.com>:
Dear Listers
I?ve been using ggmap package to produce crime Heat map. But I?ve noticed the
following warning message when executing my code:
In loop_apply(n, do.ply) :
Removed 4945 rows containing non-finite values (stat_density2d).
I?ve googled this message but I couldn?t find any good answers.
Is this related to ggmap package or one of its depending package?
What does it mean?
Thanks!
[[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.
[[alternative HTML version deleted]]
Look at your data.frame with str() and see if the variables you think are numeric are actually factors. is.finite(factor()) reports TRUE but lots of functions expecting numeric data will abort when given factor data. E.g. library(ggplot2)> d <- data.frame(X=factor(round(sin(1:1000),1)),Y=factor(round(sin((1:1000)*4),1)))> head(d)X Y 1 0.8 -0.8 2 0.9 1 3 0.1 -0.5 4 -0.8 -0.3 5 -1 0.9 6 -0.3 -0.9> ggplot(d, aes(x=X, y=Y)) + geom_point() + geom_density2d()Error in if (any(h <= 0)) stop("bandwidths must be strictly positive") : missing value where TRUE/FALSE needed> # no contours displayed > ggplot(d, aes(x=as.numeric(as.character(X)),y=as.numeric(as.character(Y)))) + geom_point() + geom_density2d()> # see contours of 2d densityIf you have factors where you expect numbers then try rereading the file using read.table(colClasses=c("numeric","numeric",...), ...) and look at the missing values to see why they appeared that way. (E.g., does the text file use commas for the decimal points or thousands separators?) Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Jun 30, 2015 at 12:43 PM, Chichi Shu <chichi.shu at hotmail.com> wrote:> Dear Listers > > > > I?ve been using ggmap package to produce crime Heat map. But I?ve noticed > the following warning message when executing my code: > > > > In loop_apply(n, do.ply) : > > Removed 4945 rows containing non-finite values (stat_density2d). > > > > I?ve googled this message but I couldn?t find any good answers. > > > > Is this related to ggmap package or one of its depending package? > > > > What does it mean? > > > > Thanks! > > [[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. >[[alternative HTML version deleted]]