vignettes/help/installing_gnparser.Rmd
installing_gnparser.Rmd
This tutorial will guide you through the installation of gnparser
, a required binary file for using our R package. The installation process varies depending on your operating system (Windows, macOS, or Linux).
We provide two installation options: using reproducible code or following a manual step-by-step installation. The first option is a quick and easy way to install the software. In case of errors, you can try the manual step-by-step approach.
Installing and loading bdc package
install.packages("bdc")
library(bdc)
⚠ Important: Get the latest version of gnparser. The execution of this step is required independently of our operation system.
get_latest_gnparser_version <- function() {
url <- "https://github.com/gnames/gnparser/releases"
# Reads the content of the releases page
page <- xml2::read_html(url)
# Extracts the first tag containing the version, using a CSS selector
version <- page %>%
rvest::html_element(".Link--primary") %>%
rvest::html_text2()
version <- gsub("v", "", version)
return(version)
}
latest_version <- get_latest_gnparser_version()
message("Latest version of gnparser: ", latest_version)
Download the lastest version of gnparser
link <- "https://github.com/gnames/gnparser/releases/download/"
url_latest_version = paste0(link, "v", latest_version, "/gnparser-v", latest_version, "-win-arm.zip")
file_name = here::here(paste0(latest_version, ".zip"))
download.file(url_latest_version, file_name)
Move file to the recommended directory
# Extracts the file in a temporary directory
unzip(file_name, exdir = here::here())
# Sets the destination filename
AppData_path <- Sys.getenv("AppData")
# Moves the executable to the target directory
file.copy("gnparser.exe", AppData_path, recursive = TRUE)
Download the lastest version of gnparser
link <- "https://github.com/gnames/gnparser/releases/download/"
url_latest_version = paste0(link, "v", latest_version, "/gnparser-v", latest_version, "-linux-arm.tar.gz")
file_name = here::here(paste0(latest_version, ".tar.gz"))
download.file(url_latest_version, file_name)
Move file to the recommended directory
# Extracts the file in a temporary directory
untar(file_name, exdir = here::here())
# Moves the executable to the target directory
file.copy(here::here("gnparser"), "~/bin")
⚠️IMPORTANT: Before installing gnparser, it is highly recommend to install Homebrew, which is a package manager for macOS and Linux that simplifies the installation of software and libraries directly from the terminal. You can use the steps below to install Homebrew. Moreover, a detailed explanation on how to install homebrew can be found in this video.
Open Terminal
Command + Space
to open Spotlight SearchUsing Homebrew (Recommended)
After that, close the terminal and refresh the R section.
Download the installer
-win-64.zip
)Open Command Prompt
Windows + R
on your keyboardcmd
and press EnterCreate installation directory
mkdir C:\bin
Extract and move the file
Extract the downloaded zip file
Copy the gnparser.exe
file to C:using either:
copy path\to\downloaded\gnparser.exe C:\bin
Add to System Path
Windows + X
and select “System”C:\bin
Verify installation
gnparser --version
Open Terminal
Ctrl + Alt + T
(on most Linux distributions)Download the binary
Verify installation
bash gnparser --version
Open Terminal
Command + Space
to open Spotlight SearchUsing Homebrew (Recommended)
Manual Installation
-mac.tar.gz
) from gnparser releases
If you encounter any issues:
Command not found
Permission denied
Security warnings
After installation, test if gnparser is working correctly:
# In R, try parsing a scientific name
test <-
bdc::bdc_clean_names(c("OCOTEA odorifera", "ocotea odorifera", "ocotea cf. odorifera"))