Data scraping: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 7: | Line 7: | ||
# It will take about two minutes for the results to be scraped and saved. | # It will take about two minutes for the results to be scraped and saved. | ||
# | #---------------------------------------------------------------------------------- | ||
rm(list=ls()) | rm(list=ls()) | ||
# | #---------------------------------------------------------------------------------- | ||
# Install & load packages | # Install & load packages | ||
# | #---------------------------------------------------------------------------------- | ||
install.packages("plyr") | install.packages("plyr") | ||
install.packages("writexl") | install.packages("writexl") | ||
| Line 20: | Line 20: | ||
library(writexl) | library(writexl) | ||
library(plyr) | library(plyr) | ||
# | #---------------------------------------------------------------------------------- | ||
# Load functions from Github | # Load functions from Github | ||
# | #---------------------------------------------------------------------------------- | ||
source("https://github.com/lakik/apesatlas_scraping/raw/refs/heads/main/script") | source("https://github.com/lakik/apesatlas_scraping/raw/refs/heads/main/script") | ||
# | #---------------------------------------------------------------------------------- | ||
# Define the path to save the results | # Define the path to save the results | ||
# | #---------------------------------------------------------------------------------- | ||
path_to_save = "YOUR_PATH" # change accordingly (e.g. "D:/Users/APES/APESATLAS/") | path_to_save = "YOUR_PATH" # change accordingly (e.g. "D:/Users/APES/APESATLAS/") | ||
# | #---------------------------------------------------------------------------------- | ||
# Run scraper function | # Run scraper function | ||
# | #---------------------------------------------------------------------------------- | ||
scrape_apesatlas(path_to_save) | scrape_apesatlas(path_to_save) | ||
# | #---------------------------------------------------------------------------------- | ||
Revision as of 09:26, 14 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 (e.g. "D:/Users/APES/APESATLAS/")
#----------------------------------------------------------------------------------
# Run scraper function
#----------------------------------------------------------------------------------
scrape_apesatlas(path_to_save)
#----------------------------------------------------------------------------------