尝试使用 purrr::map 一次取回包含 2,000 行的小标题列表,而不是使用 for 循环。我可能不必告诉你这将花费很长时间
interval <- seq(from = 1, to = 323200, by = 2000)
list_of_tibbles <-
purrr::map(interval,
~ occ_search(taxonKey = actinopterygii$classKey,
country="BR",
limit=2000,
start= .x)
)
我不打算获取你所有的数据,但你会得到类似的输出
[[1]]
Records found [323200]
Records returned [2000]
No. unique hierarchies [661]
No. media records [2000]
No. facets [0]
Args [limit=2000, offset=1, taxonKey=204, country=BR, fields=all]
# A tibble: 2,000 x 145
key scientificName decimalLatitude decimalLongitude issues datasetKey publishingOrgKey
<chr> <chr> <dbl> <dbl> <chr> <chr> <chr>
1 2550… Chaetodipteru… -7.91 -34.8 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
2 2550… Myrichthys oc… -7.90 -34.8 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
3 2550… Mugil curema … -7.91 -34.8 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
4 2550… Centropomus u… -7.91 -34.8 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
5 2550… Trachinotus c… -7.91 -34.8 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
6 2550… Phractocephal… -3.18 -59.9 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
7 2550… Diapterus aur… -7.91 -34.8 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
8 2550… Chaetodipteru… -7.91 -34.8 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
9 2550… Centropomus u… -7.91 -34.8 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
10 2550… Calophysus ma… -3.18 -59.9 cdrou… 50c9509d-… 28eb1a3f-1c15-4…
# … with 1,990 more rows, and 138 more variables: installationKey <chr>,
# publishingCountry <chr>, protocol <chr>, lastCrawled <chr>, lastParsed <chr>,
# crawlId <int>, extensions <chr>, basisOfRecord <chr>, occurrenceStatus <chr>,
# taxonKey <int>, kingdomKey <int>, phylumKey <int>, classKey <int>, orderKey <int>,
# familyKey <int>, genusKey <int>, speciesKey <int>, acceptedTaxonKey <int>,
# acceptedScientificName <chr>, kingdom <chr>, phylum <chr>, order <chr>, family <chr>,
# genus <chr>, species <chr>, genericName <chr>, specificEpithet <chr>, taxonRank <chr>,
# taxonomicStatus <chr>, dateIdentified <chr>, coordinateUncertaintyInMeters <dbl>,
# stateProvince <chr>, year <int>, month <int>, day <int>, eventDate <chr>,
# modified <chr>, lastInterpreted <chr>, references <chr>, license <chr>,
# identifiers <chr>, facts <chr>, relations <chr>, gadm.level0.gid <chr>,
# gadm.level0.name <chr>, gadm.level1.gid <chr>, gadm.level1.name <chr>,
# gadm.level2.gid <chr>, gadm.level2.name <chr>, gadm.level3.gid <chr>,
# gadm.level3.name <chr>, geodeticDatum <chr>, class <chr>, countryCode <chr>,
# recordedByIDs <chr>, identifiedByIDs <chr>, country <chr>, rightsHolder <chr>,
# identifier <chr>, http...unknown.org.nick <chr>, verbatimEventDate <chr>,
# datasetName <chr>, collectionCode <chr>, gbifID <chr>, verbatimLocality <chr>,
# occurrenceID <chr>, taxonID <chr>, catalogNumber <chr>, recordedBy <chr>,
# http...unknown.org.occurrenceDetails <chr>, institutionCode <chr>, rights <chr>,
# eventTime <chr>, identifiedBy <chr>, identificationID <chr>, name <chr>,
# occurrenceRemarks <chr>, gadm <chr>, informationWithheld <chr>,
# recordedByIDs.type <chr>, recordedByIDs.value <chr>, individualCount <int>,
# establishmentMeans <chr>, continent <chr>, organismQuantityType <chr>, habitat <chr>,
# http...rs.tdwg.org.dwc.terms.organismQuantity <chr>,
# georeferenceVerificationStatus <chr>, verbatimSRS <chr>, verbatimCoordinateSystem <chr>,
# county <chr>, locality <chr>, taxonRemarks <chr>, preparations <chr>, disposition <chr>,
# vernacularName <chr>, organismName <chr>, fieldNotes <chr>, originalNameUsage <chr>,
# http...rs.tdwg.org.dwc.terms.organismQuantityType <chr>, …
您会注意到,您返回的不仅有数据,还有其他元数据。将所有的 data 粘合到一个大数据框另一个 map
glued_data <-
purrr::map(list_of_tibbles, "data") %>%
bind_rows()
dim(glued_data)
[1] 10000 162