Skip to content

Installing hydrotools

Joey Kleiner edited this page Apr 14, 2021 · 10 revisions

The following process has been used successfully on multiple machines:

It involves removing all packages (except for the base R packages), before installing devtools and finally hydrotools.

Using R version 3.6.1:

##################################################################################################
# REMOVE ALL PACKAGES 
##################################################################################################
# create a list of all installed packages
ip_all <- as.data.frame(installed.packages())

# we don't want to remove base or recommended packages
ip_NoBase <- ip_all[!(ip_all[,"Priority"] %in% c("base", "recommended")),]
ip <- ip_NoBase

# determine the library where the packages are installed
path.lib <- unique(ip$LibPath)

# create a vector with all the names of the packages you want to remove
pkgs.to.remove <- ip[,1]
head(pkgs.to.remove)

# remove the packages
sapply(pkgs.to.remove, remove.packages, lib = path.lib)

##################################################################################################
# INSTALL HYDROTOOLS
##################################################################################################
install.packages("devtools")
library("devtools")
install_github("HARPgroup/hydro-tools")
library("hydrotools")
#:)
##################################################################################################

Upgrading to R version 4.0.5:

Since the above was a success, I decided to go ahead and upgrade my R version to 4.0.5 and give it a whirl

##################################################################################################
# RUN FROM RGui - NOT RStudio 
##################################################################################################
R.Version()

library("installr")
updateR()

# When installing, I accepted all the defaults when prompted
# Then I selected the following when prompted:
#  "Do you wish to copy your packages from the older version of R to the newer version of R?" - NO
#  "Do you wish to copy your 'Rprofile.site' from the older version of R to the newer version of R?" - NO
#  "Do you wish to update your packages in the newly installed R?" - NO
#  "Do you wish to start the Rgui.exe of your new R installation?" - YES

##################################################################################################
# THEN FROM RStudio 
##################################################################################################
# In the top menu bar: Tools -> Global Options... -> General -> Change R Version to 4.0.5 -> OK
# The in the top menu bar: Session -> Quit Session... 

##################################################################################################
# INSTALL HYDROTOOLS
##################################################################################################
# Notice all installed packages were removed when upgrading R version (This is good, its best to start from scratch)
ip_all <- as.data.frame(installed.packages())

install.packages("devtools")
library("devtools")
install_github("HARPgroup/hydro-tools")
library("hydrotools")
#:)

# Then you can reinstall any other packages as needed, one at a time using install.packages("XXXXX")
##################################################################################################

This approach has been used with success to help eliminate any of the weird errors and warnings you get during installation - Also make sure you're doing all this directly from your C drive and not a OneDrive folder

Related Issues:

Clone this wiki locally