[R] Hexbin: Counting Bins That Meet Certain Criteria

Sidoti, Salvatore A. sidoti.23 at buckeyemail.osu.edu
Fri Dec 18 02:06:28 CET 2015

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


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.

More information about the R-help mailing list