Skip to content

Commit fa710db

Browse files
committed
Some gc in magbin
1 parent d8abaae commit fa710db

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

R/magbin.R

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -101,31 +101,6 @@
101101
}
102102

103103
.trihexgrid = function(xlim=c(0,100), ylim=c(0,100), step=c(1,1), direction='h'){
104-
# if(direction=='h'){
105-
# xvec1 = seq(xlim[1], xlim[2]+step[1], by=step[1])
106-
# xvec2 = seq(xlim[1], xlim[2]+step[1]/2, by=step[1])
107-
#
108-
# yvec1 = seq(ylim[1], ylim[2]+step[2]*0.8660254, by=2*step[2]*0.8660254)
109-
# yvec2 = seq(ylim[1]+step[2]*0.2886751-step[2]*0.8660254, ylim[2]-step[2]*0.2886751+step[2]*0.8660254, by=2*step[2]*0.8660254)
110-
#
111-
# grid1 = expand.grid(x=xvec1, y=yvec1)
112-
# grid2 = expand.grid(x=xvec2, y=yvec2)
113-
# grid3 = expand.grid(x=xvec1-step[1]/2, y=yvec1-step[2]*0.8660254)
114-
# grid4 = expand.grid(x=xvec2-step[1]/2, y=yvec2-step[2]*0.8660254)
115-
# }
116-
# if(direction=='v'){
117-
# xvec1 = seq(xlim[1], xlim[2]+step[1]*0.8660254, by=2*step[1]*0.8660254)
118-
# xvec2 = seq(xlim[1]+step[1]*0.2886751-step[1]*0.8660254, xlim[2]-step[1]*0.2886751+step[1]*0.8660254, by=2*step[1]*0.8660254)
119-
#
120-
# yvec1 = seq(ylim[1], ylim[2]+step[2], by=step[2])
121-
# yvec2 = seq(ylim[1], ylim[2]+step[2]/2, by=step[2])
122-
#
123-
# grid1 = expand.grid(x=xvec1, y=yvec1)
124-
# grid2 = expand.grid(x=xvec2, y=yvec2)
125-
# grid3 = expand.grid(x=xvec1-step[1]*0.8660254, y=yvec1-step[2]/2)
126-
# grid4 = expand.grid(x=xvec2-step[1]*0.8660254, y=yvec2-step[2]/2)
127-
# }
128-
# return(rbind(cbind(grid1, type=1), cbind(grid2,type=2), cbind(grid3, type=1), cbind(grid4, type=2)))
129104
.trigrid(xlim=xlim, ylim=ylim, step=step, direction=direction, offset=0.5)
130105
}
131106

@@ -306,7 +281,8 @@
306281
output = list(bins=data.frame(grid, count=bincount, zstat=binzstat), dust=dust, groups=groups,
307282
xlim=xlim, ylim=ylim, step=step, dustlim=dustlim, shape=shape, direction=direction, use=use)
308283
class(output) = 'magbin'
309-
return(output)
284+
gc() #this seems to be need, not sure why!
285+
return(invisible(output))
310286
}
311287

312288
plot.magbin = function(x, colramp=hcl.colors(21), colstretch='lin', sizestretch='lin',
@@ -532,6 +508,7 @@ magbin = function(x, y, z=NULL, xsup=NULL, ysup=NULL, xlim=NULL, ylim=NULL, zlim
532508
ydata=y, locut=locut, hicut=hicut, type=type, ...)
533509
}
534510
}
511+
gc() #this seems to be need, not sure why!
535512
return(invisible(bincount))
536513
}
537514

0 commit comments

Comments
 (0)