Data scraping: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<pre> | <pre> | ||
# SCRIPT START | |||
### APES Atlas Web Scraper | ### APES Atlas Web Scraper | ||
# The following R code extracts data from the standardized APES Atlas tables. | # 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., Rstudio or Notepad++). | ||
# It will take about two minutes for the results to be scraped and saved. | |||
# How to: | |||
# 1. Copy all lines between '# SCRIPT START' to '# SCRIPT END'and paste it into your editor. | |||
# 2. In the following line, change 'YOUR_PATH' to the folder path where you want to store the scraped data: | |||
path_to_save = "YOUR_PATH" # e.g. "D:/Users/APESATLAS/" | |||
# 3. Copy again all lines between '# SCRIPT START' to '# SCRIPT END'and paste it into the RGui/R-console. | |||
# 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. | |||
#---------------------------------------------------------------------------------- | #---------------------------------------------------------------------------------- | ||
| Line 26: | Line 36: | ||
#---------------------------------------------------------------------------------- | #---------------------------------------------------------------------------------- | ||
# Define the path to save the results | # Define the path to save the results | ||
#---------------------------------------------------------------------------------- | #---------------------------------------------------------------------------------- | ||
# Run scraper function | # Run scraper function | ||
| Line 33: | Line 41: | ||
scrape_apesatlas(path_to_save) | scrape_apesatlas(path_to_save) | ||
#---------------------------------------------------------------------------------- | #---------------------------------------------------------------------------------- | ||
# SCRIPT END | |||
Revision as of 13:05, 20 January 2026
# SCRIPT START
### 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., Rstudio or Notepad++).
# How to:
# 1. Copy all lines between '# SCRIPT START' to '# SCRIPT END'and paste it into your editor.
# 2. In the following line, change 'YOUR_PATH' to the folder path where you want to store the scraped data:
path_to_save = "YOUR_PATH" # e.g. "D:/Users/APESATLAS/"
# 3. Copy again all lines between '# SCRIPT START' to '# SCRIPT END'and paste it into the RGui/R-console.
# 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.
#----------------------------------------------------------------------------------
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
#----------------------------------------------------------------------------------
# Run scraper function
#----------------------------------------------------------------------------------
scrape_apesatlas(path_to_save)
#----------------------------------------------------------------------------------
# SCRIPT END