knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", echo = TRUE, warning = FALSE, eval = F )
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)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap gnames/gn brew install gnparser
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
cmd
mkdir C:\bin
Extract and move the file
Extract the downloaded zip file
Copy the gnparser.exe
file to C:\bin using either:
cmd
copy path\to\downloaded\gnparser.exe C:\bin
Add to System Path
Windows + X
and select "System"C:\bin
Verify installation
cmd
gnparser --version
Open Terminal
Ctrl + Alt + T
(on most Linux distributions)Download the binary
``` bash
mkdir -p ~/tmp cd ~/tmp
wget https://github.com/gnames/gnparser/releases/download/v1.10.1/gnparser-v1.10.1-linux.tar.gz
tar xvf gnparser-*.tar.gz
sudo mv gnparser /usr/local/bin ```
Verify installation
bash gnparser --version
Open Terminal
Command + Space
to open Spotlight SearchUsing Homebrew (Recommended)
``` bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap gnames/gn brew install gnparser ```
Manual Installation
-mac.tar.gz
) from gnparser releasesbash
cd ~/Downloads
bash
tar xvf gnparser-v*.tar.gz
bash
sudo mv gnparser /usr/local/bin
If you encounter any issues:
Command not found
Permission denied
bash
chmod +x /usr/local/bin/gnparser
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.