Introduction
Installation
Please use the following link to access instructions for installing R and RStudio on a Windows:
https://teacherscollege.screenstepslive.com/a/1108074-install-r-and-r-studio-for-windows
> install.packages("installr")
> require(installr)
> updateR()
(Please note that 'Rtools' is a package for Windows and is not necessary for Mac.)
Download RTools4.0 from this address:
https://cran.r-project.org/bin/windows/Rtools/rtools40.html
Run ".exe" file as admin and install it.
Open Rstudio and run the line below in it:
write('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', file = "~/.Renviron", append = TRUE)
After running the code close Rstudio.
Now open the Rstudio again and verify that make can be found:
Sys.which("make")
> install.packages("lidR", type = "source") or install.packages("lidR")
> install.packages("raster", type = "source") or install.packages("raster")
> install.packages("rgdal", type = "source") or install.packages("rgdal", type="binary")
> install.packages("remotes")
> remotes::install_github("r-lib/rlang")
> install.packages("RMCC")
> install.packages("stars")
> install.packages("terra")
> install.packages("devtools", type = "win.binary")
or
> install.packages("devtools")
> devtools::install_github("tylermorganwall/rayshader")
or
> install_github("tylermorganwall/rayshader", INSTALL_opts="--no-multiarch")
> install.packages("dplyr")
> install.packages("lmom")
> install.packages("gmp",type="binary")
> install.packages("Rdimtools")
> install.packages("RCSF")
> install.packages("ggplot2")
Double-check if the packages are installed
By running:
> library(lidR)
> packageVersion("lidR")
> library(raster)
> library(rgdal)
> library(rlang)
> library(ggplot2)
> library(dplyr)
> library(lmom)
> library(Rdimtools)
> library(terra)
> library(rayshader)
Installing R and Rstudio on Mac
Please use the following link to access instructions for installing R and RStudio on a Mac:
https://teacherscollege.screenstepslive.com/a/1135059-install-r-and-r-studio-for-mac
To install the lidR package in R on a Mac, you can follow these steps:
> install.packages("devtools")
> install.packages("lidR")
> library(lidR)
Installing r package that has c/c++ code (optional)
However, if you are trying to build an R package that has C/C++ code, you may need to install additional tools on your Mac to build and compile the code. Here are the steps to install the necessary tools:
> xcode-select --install�
This will prompt you to install the Command Line Tools for Xcode.
�/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
> brew install gcc
> brew install gfortran
These commands will install the GNU Compiler Collection (gcc) and the GNU Fortran compiler (gfortran).
> install.packages("raster", type = "source")
> install.packages("rgdal", type = "source") or install.packages("rgdal", type="binary")
> install.packages("remotes")
> remotes::install_github("r-lib/rlang") or install.packages("rlang")
> install.packages("RMCC")
> install.packages("stars")
> install.packages("terra")
> install.packages("devtools")
> devtools::install_github("tylermorganwall/rayshader")
or
> install_github("tylermorganwall/rayshader", INSTALL_opts="--no-multiarch")
> install.packages("dplyr")
> install.packages("lmom")
> install.packages("gmp",type="binary")
> install.packages("Rdimtools")
> install.packages("RCSF")
> install.packages("ggplot2")
Double-check if the packages are installed
By running:
> library(lidR)
> packageVersion("lidR")
> library(raster)
> library(rgdal)
> library(rlang)
> library(ggplot2)
> library(dplyr)
> library(lmom)
> library(Rdimtools)
> library(terra)
> library(rayshader)