Jump to content

Data scraping

From The APES Atlas
Revision as of 22:43, 7 November 2025 by WikiEdit (talk | contribs)
      1. APES Atlas Web Scraper
  1. The following R code extracts data from the standardized APES Atlas tables.
  2. The functions below need to be loaded into R.
  1. ---------------------------------------------------------------------------------------------------------------------------------

rm(list=ls())

  1. ---------------------------------------------------------------------------------------------------------------------------------
  2. Install & load packages
  3. ---------------------------------------------------------------------------------------------------------------------------------
  4. install.packages("plyr")
  5. install.packages("writexl")
  6. install.packages("jsonlite")
  7. install.packages("httr2")

library(httr2) library(jsonlite) library(writexl) library(plyr)

  1. ---------------------------------------------------------------------------------------------------------------------------------
  2. Load functions from Github
  3. ---------------------------------------------------------------------------------------------------------------------------------

source("https://github.com/lakik/apesatlas_scraping/raw/refs/heads/main/script")

  1. ---------------------------------------------------------------------------------------------------------------------------------
  2. Define the path to save the results
  3. ---------------------------------------------------------------------------------------------------------------------------------

path_to_save = "D:/Users/lkulik/Senckenberg Dropbox/Lars Kulik/APES/APES Wiki/Test/"

  1. ---------------------------------------------------------------------------------------------------------------------------------
  2. Run scraper function
  3. ---------------------------------------------------------------------------------------------------------------------------------

scrape_apesatlas(path_to_save,api_url)

  1. ---------------------------------------------------------------------------------------------------------------------------------