R Under development (unstable) (2024-09-03 r87093 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(hexbin) > > if(R.version$major != "1" || as.numeric(R.version$minor) >= 7) + RNGversion("1.6") Warning messages: 1: In RNGkind("Marsaglia-Multicarry", "Buggy Kinderman-Ramage", "Rounding") : buggy version of Kinderman-Ramage generator used 2: In RNGkind("Marsaglia-Multicarry", "Buggy Kinderman-Ramage", "Rounding") : non-uniform 'Rounding' sampler used 3: In RNGkind("Marsaglia-Multicarry", "Buggy Kinderman-Ramage", "Rounding") : RNGkind: Marsaglia-Multicarry has poor statistical properties > set.seed(213) > x1 <- rnorm(10000) > y1 <- rnorm(10000) > > x2 <- rnorm(10000,mean = .3) > y2 <- rnorm(10000,mean = .3) > > rx <- range(x1,x2) > ry <- range(y1,y2) > > str(bin1 <- hexbin(x1,y1, xbnds = rx, ybnds = ry)) Formal class 'hexbin' [package "hexbin"] with 16 slots ..@ cell : int [1:535] 16 20 48 70 74 75 76 80 99 101 ... ..@ count : int [1:535] 1 1 1 1 1 1 1 1 1 1 ... ..@ xcm : num [1:535] 0.37 1.338 0.721 -1.846 -0.965 ... ..@ ycm : num [1:535] -3.66 -3.71 -3.54 -3.2 -3.24 ... ..@ xbins : num 30 ..@ shape : num 1 ..@ xbnds : num [1:2] -3.8 4.3 ..@ ybnds : num [1:2] -3.71 4.17 ..@ dimen : num [1:2] 36 31 ..@ n : int 10000 ..@ ncells: int 535 ..@ call : language hexbin(x = x1, y = y1, xbnds = rx, ybnds = ry) ..@ xlab : chr "x1" ..@ ylab : chr "y1" ..@ cID : NULL ..@ cAtt : int(0) > str(bin2 <- hexbin(x2,y2, xbnds = rx, ybnds = ry)) Formal class 'hexbin' [package "hexbin"] with 16 slots ..@ cell : int [1:545] 41 51 75 76 104 107 110 114 136 138 ... ..@ count : int [1:545] 1 1 1 1 1 2 1 1 2 1 ... ..@ xcm : num [1:545] -1.141 1.445 -0.493 -0.324 -0.995 ... ..@ ycm : num [1:545] -3.42 -3.45 -3.24 -3.35 -2.9 ... ..@ xbins : num 30 ..@ shape : num 1 ..@ xbnds : num [1:2] -3.8 4.3 ..@ ybnds : num [1:2] -3.71 4.17 ..@ dimen : num [1:2] 36 31 ..@ n : int 10000 ..@ ncells: int 545 ..@ call : language hexbin(x = x2, y = y2, xbnds = rx, ybnds = ry) ..@ xlab : chr "x2" ..@ ylab : chr "y2" ..@ cID : NULL ..@ cAtt : int(0) > > str(erode(bin1)) Formal class 'erodebin' [package "hexbin"] with 19 slots ..@ eroded: logi [1:535] FALSE FALSE FALSE FALSE FALSE FALSE ... ..@ cdfcut: num 0.5 ..@ erode : int [1:71] 12 35 34 57 52 4 30 101 138 150 ... ..@ cell : int [1:535] 16 20 48 70 74 75 76 80 99 101 ... ..@ count : int [1:535] 1 1 1 1 1 1 1 1 1 1 ... ..@ xcm : num [1:535] 0.37 1.338 0.721 -1.846 -0.965 ... ..@ ycm : num [1:535] -3.66 -3.71 -3.54 -3.2 -3.24 ... ..@ xbins : num 30 ..@ shape : num 1 ..@ xbnds : num [1:2] -3.8 4.3 ..@ ybnds : num [1:2] -3.71 4.17 ..@ dimen : num [1:2] 36 31 ..@ n : int 10000 ..@ ncells: int 535 ..@ call : language hexbin(x = x1, y = y1, xbnds = rx, ybnds = ry) ..@ xlab : chr "x1" ..@ ylab : chr "y1" ..@ cID : NULL ..@ cAtt : int(0) > > str(smbin1 <- smooth.hexbin(bin1)) Formal class 'smoothbin' [package "hexbin"] with 17 slots ..@ wts : num [1:3] 48 4 1 ..@ cell : int [1:906] 17 18 19 21 22 23 51 52 53 54 ... ..@ count : int [1:906] 1 1 1 1 1 1 1 4 5 2 ... ..@ xcm : num [1:535] 0.37 1.338 0.721 -1.846 -0.965 ... ..@ ycm : num [1:535] -3.66 -3.71 -3.54 -3.2 -3.24 ... ..@ xbins : num 34 ..@ shape : num 1 ..@ xbnds : num [1:2] -4.34 4.84 ..@ ybnds : num [1:2] -4.23 4.7 ..@ dimen : num [1:2] 40 35 ..@ n : int 10000 ..@ ncells: int 535 ..@ call : language hexbin(x = x1, y = y1, xbnds = rx, ybnds = ry) ..@ xlab : chr "x1" ..@ ylab : chr "y1" ..@ cID : NULL ..@ cAtt : int(0) > (smbin2 <- smooth.hexbin(bin2)) 'hexbin' object from call: hexbin(x = x2, y = y2, xbnds = rx, ybnds = ry) n = 10000 points in nc = 545 hexagon cells in grid dimensions 40 by 35 > > str(erodebin1 <- erode.hexbin(smbin1)) Formal class 'erodebin' [package "hexbin"] with 19 slots ..@ eroded: logi [1:906] FALSE FALSE FALSE FALSE FALSE FALSE ... ..@ cdfcut: num 0.5 ..@ erode : int [1:73] 11 35 95 100 117 88 6 39 167 232 ... ..@ cell : int [1:906] 17 18 19 21 22 23 51 52 53 54 ... ..@ count : int [1:906] 1 1 1 1 1 1 1 4 5 2 ... ..@ xcm : num [1:535] 0.37 1.338 0.721 -1.846 -0.965 ... ..@ ycm : num [1:535] -3.66 -3.71 -3.54 -3.2 -3.24 ... ..@ xbins : num 34 ..@ shape : num 1 ..@ xbnds : num [1:2] -4.34 4.84 ..@ ybnds : num [1:2] -4.23 4.7 ..@ dimen : num [1:2] 40 35 ..@ n : int 10000 ..@ ncells: int 535 ..@ call : language hexbin(x = x1, y = y1, xbnds = rx, ybnds = ry) ..@ xlab : chr "x1" ..@ ylab : chr "y1" ..@ cID : NULL ..@ cAtt : int(0) > (erodebin2 <- erode.hexbin(smbin2)) 'hexbin' object from call: hexbin(x = x2, y = y2, xbnds = rx, ybnds = ry) n = 10000 points in nc = 545 hexagon cells in grid dimensions 40 by 35 > > if(FALSE)## does not work -- what funny stuff is hdiffplot() doing??? + par(mfrow = c(2,1)) > > if(exists("hdiffplot", mode="function")) { ## not yet in new hexbin + hdiffplot(bin1,bin2, main = "Original N(0,*) Random bins") + + hdiffplot(smbin1,smbin2, main = "smooth.hexbin() smoothed bins") + + plot.new() + hdiffplot(erodebin1,erodebin2, main = "erode.hexbin()d smoothed bins") + }# not yet > > proc.time() user system elapsed 0.70 0.06 0.70