gBuffer won't install

First time user!
I am using Spatialeco package to detect sharks using acoustic receivers. My teacher created a buffer of 300m using Spatialeco and gBuffer package. It was working but now says my version of R does not support gBuffer. Please help! I have an assignment due today! I can't find the right package for my version of R (4.2)

detectionsS1a<-detection_series(trackS1, receiver.locs3, mydir, xrange, yrange)

Error in gBuffer(rec.sp, byid = T, id = rec.sp[[1]], width = 300) :
could not find function "gBuffer"
Warning in install.packages :
package ‘gbuffer’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at

I believe there is no R package called gBuffer, maybe you are referring to the gBuffer() function from the rgeos package?

If so, load rgeos before using the function.

Thank you, I have just installed this package but it will still not work. I tried geo.buffer however it said I have projected coordinates (UTM) not lat long. You will see object 'Range' has been given the gBuffer argument. It was working correctly until yesterday. Thanks you for helping :slight_smile:

This is the function my teacher created to make the detection series and apply the buffer of 300m::
detection_series<-function(animaltrack, receiver.locs, mydirectory, easting, northing) {
if (!require(x,character.only=TRUE)){

rec.sp<-SpatialPointsDataFrame(coords=matrix(c(receiver.locs$x, receiver.locs$y), nrow=nrow(receiver.locs), ncol=2),$id), proj=CRS('+proj=utm +zone=55 +south +ellps=GRS80 +units=m +no_defs'))
range<-gBuffer(rec.sp, byid=T, id=rec.sp[[1]], width=300)
track.sp<-SpatialPointsDataFrame(coords=matrix(c(animaltrack$x, animaltrack$y), nrow=nrow(animaltrack), ncol=2),$date), proj=CRS('+proj=utm +zone=55 +south +ellps=GRS80 +units=m +no_defs'))
track.line<-Lines(list(Line(coordinates(track.sp))), 'animal')
dets<, range)
det$x<-receiver.locs$x[match(det$, receiver.locs$id)]
det$y<-receiver.locs$y[match(det$, receiver.locs$id)]
land<- readOGR(dsn=mydirectory, layer="tas_land_map_wgs84")
land.utm<-spTransform(land, CRS('+proj=utm +zone=55 +south +ellps=GRS80 +units=m +no_defs'))
mpas<- readOGR(dsn=mydirectory, layer="maria_reserve")
if(.Platform$OS.type=="windows") {
quartz<-function() windows()
plot(land.utm, xlim=easting, ylim=northing, col='lightgrey',xlab='Easting (UTM)', ylab='Northing (UTM)', axes=TRUE, xaxs='i', yaxs='i')
plot(mpas, add=T, col=adjustcolor('indianred1', .5))
plot(rec.sp, add=T, pch=20)
plot(range, add=T)
lines(animaltrack$x, animaltrack$y, col='red')

I just ran it again AND IT WORKED!!! Thank you, you are a LIFE SAVER!!

Grateful uni student!!!