File: hdiffplot.Rout.save

package info (click to toggle)
r-cran-hexbin 1.28.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,784 kB
  • sloc: fortran: 334; ansic: 16; sh: 13; makefile: 6
file content (160 lines) | stat: -rw-r--r-- 5,855 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

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.486   1.388   0.369