0
library(dplyr)
library(tidyr)
library(mapview)

# species name Quercus leucotrichophora

gbif("Quercus", "leucotrichophora", download = T)

sp1 <- gbif("Quercus", "leucotrichophora", geo=T, download = T) #  download is essebtial for data.frame

class(sp1) # object is a data.frame

dim(sp1)

# extract only lat long columns
spg <- sp1%>%select( lon,lat)

The error it is throwing is as follows:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘select’ for signature ‘"data.frame"

1
  • try dplyr::select()
    – JonasV
    Mar 3, 2021 at 7:33

1 Answer 1

1

Where has the gbif function come from? Oh, maybe its dismo (you didn't mention this in your question):

> library(dismo)
Loading required package: raster
Loading required package: sp

Attaching package: ‘raster’

The following object is masked from ‘package:dplyr’:

    select

and because that's attached raster that has masked the select from dplyr.

But that's okay, you should never use select from dplyr anyway, instead get columns in the usual R way:

> spg = sp1[,c("lon","lat")]
> head(spg)
       lon      lat
1 79.65582 29.46042
2 82.48634 28.09335
3 79.53100 29.36000
4 78.35500 30.67417
1
  • Yeah, gbif () is from dismo package... thank you it helped Mar 4, 2021 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.