Sidoti, Salvatore A.
2015-Dec-15 00:48 UTC
[R] Hexbin: Counting Bins That Meet Certain Criteria
Greetings! Is there a way to count the bins in a hexbin plot that meet certain criteria? For instance, what if I wanted to count the bins (hexes) that have a datapoint density of some number x? Thank you!
David L Carlson
2015-Dec-15 17:18 UTC
[R] Hexbin: Counting Bins That Meet Certain Criteria
Something like> library(hexbin) > set.seed(42) > xy <- matrix(rnorm(1000), 500) > xy.hex <- hexbin(xy) > table(xy.hex at count)1 2 3 4 5 6 7 8 159 60 33 16 6 1 2 1> sum(xy.hex at count >= 3)[1] 59 ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Sidoti, Salvatore A. Sent: Monday, December 14, 2015 6:49 PM To: r-help at r-project.org Subject: [R] Hexbin: Counting Bins That Meet Certain Criteria Greetings! Is there a way to count the bins in a hexbin plot that meet certain criteria? For instance, what if I wanted to count the bins (hexes) that have a datapoint density of some number x? Thank you! ______________________________________________ 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.
Sidoti, Salvatore A.
2015-Dec-18 01:06 UTC
[R] Hexbin: Counting Bins That Meet Certain Criteria
Thank you, David! I adapted this code and it works very nicely with my data. Just to give you a bit of background, I am a behavioral ecologist. I am currently studying the general search patterns of wolf spiders and I have a lot of tracking data to process. I am not a coder, although I am slowing becoming one out of necessity! I created a new post today, so everyone should be seeing it shortly... Salvatore A. Sidoti PhD Student Graduate Teaching Assistant -----Original Message----- From: David L Carlson [mailto:dcarlson at tamu.edu] Sent: Tuesday, December 15, 2015 12:18 PM To: Sidoti, Salvatore A. <sidoti.23 at buckeyemail.osu.edu>; r-help at r-project.org Subject: RE: Hexbin: Counting Bins That Meet Certain Criteria Something like> library(hexbin) > set.seed(42) > xy <- matrix(rnorm(1000), 500) > xy.hex <- hexbin(xy) > table(xy.hex at count)1 2 3 4 5 6 7 8 159 60 33 16 6 1 2 1> sum(xy.hex at count >= 3)[1] 59 ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Sidoti, Salvatore A. Sent: Monday, December 14, 2015 6:49 PM To: r-help at r-project.org Subject: [R] Hexbin: Counting Bins That Meet Certain Criteria Greetings! Is there a way to count the bins in a hexbin plot that meet certain criteria? For instance, what if I wanted to count the bins (hexes) that have a datapoint density of some number x? Thank you! ______________________________________________ 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.