Data scraping: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 8: | Line 8: | ||
# INSTRUCTIONS | # INSTRUCTIONS | ||
# 1. Copy all lines from # SCRIPT START to # SCRIPT END and paste it into your editor. | # 1. Copy all lines from # SCRIPT START to # SCRIPT END and paste it into your editor. | ||
# 2. In the last line, replace "path_to_save" with the folder path where you want to store the scraped data (use only '/' or '\\' as folder separator). For example | # 2. In the last line, replace "path_to_save" with the folder path where you want to store the scraped data (use only '/' or '\\' as folder separator). For example, replace path_to_save with "D:/Users/APESATLAS/" | ||
# 3. Run all lines between # SCRIPT START to # SCRIPT END in R. | # 3. Run all lines between # SCRIPT START to # SCRIPT END in R. | ||
Revision as of 00:07, 21 January 2026
################# APES Atlas Web Scraper #################
# The following R code extracts data from the standardized APES Atlas tables.
# To execute the code, you need to have R installed and an editor (e.g. R Studio or Notepad++).
# INSTRUCTIONS
# 1. Copy all lines from # SCRIPT START to # SCRIPT END and paste it into your editor.
# 2. In the last line, replace "path_to_save" with the folder path where you want to store the scraped data (use only '/' or '\\' as folder separator). For example, replace path_to_save with "D:/Users/APESATLAS/"
# 3. Run all lines between # SCRIPT START to # SCRIPT END in R.
# Note: Windows may open during the installation of the packages. Confirm all with ‘OK’.
# It will take about two minutes for the results to be scraped and saved into the folder specified above.
# SCRIPT START
#----------------------------------------------------------------------------------
# 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
#----------------------------------------------------------------------------------
# Run scraper function
#----------------------------------------------------------------------------------
scrape_apesatlas(path_to_save)
#----------------------------------------------------------------------------------
# SCRIPT END