Jump to content

Data scraping: Difference between revisions

From The APES Atlas
No edit summary
No edit summary
Line 5: Line 5:
# The following R code extracts data from the standardized APES Atlas tables.
# The following R code extracts data from the standardized APES Atlas tables.
# The following code must be loaded into R.
# The following code must be loaded into R.
# It will take about two minutes for the results to be saved.
# It will take about two minutes for the results to be scraped and saved.


#---------------------------------------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------------------------------

Revision as of 23:20, 7 November 2025


### APES Atlas Web Scraper  

# The following R code extracts data from the standardized APES Atlas tables.
# The following code must be loaded into R.
# It will take about two minutes for the results to be scraped and saved.

#---------------------------------------------------------------------------------------------------------------------------------
rm(list=ls())
#---------------------------------------------------------------------------------------------------------------------------------
# Install & load packages
#---------------------------------------------------------------------------------------------------------------------------------
#install.packages("plyr")
#install.packages("writexl")
#install.packages("jsonlite")
#install.packages("httr2")
library(httr2)
library(jsonlite)
library(writexl)
library(plyr)
#---------------------------------------------------------------------------------------------------------------------------------
# Load functions from Github
#---------------------------------------------------------------------------------------------------------------------------------
source("https://github.com/lakik/apesatlas_scraping/raw/refs/heads/main/script")
#---------------------------------------------------------------------------------------------------------------------------------
# Define the path to save the results
#---------------------------------------------------------------------------------------------------------------------------------
path_to_save = "YOUR_PATH"  # change accordingly 
#---------------------------------------------------------------------------------------------------------------------------------
# Run scraper function
#---------------------------------------------------------------------------------------------------------------------------------
scrape_apesatlas(path_to_save,api_url)
#---------------------------------------------------------------------------------------------------------------------------------