I'm trying to prepare a report to my colleagues and students. I think the best way to make it reproducible is through Google Colab. My analysis was performed using R and some packages available on CRAN.
I am using a Jupyter Notebook with R kernel. I used the followinf link to create a Notebook with netive R kernel: https://colab.research.google.com/notebook#create=true&language=r. As you can see as follows, its running R.
a <- 1
print(a)
However, when I try to install the exactextractr
package I get the following error:
install.packages("exactextractr")
Output:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘proxy’, ‘e1071’, ‘wk’, ‘sp’, ‘terra’, ‘classInt’, ‘s2’, ‘units’, ‘Rcpp’, ‘raster’, ‘sf’
Warning message in install.packages("exactextractr"):
“installation of package ‘units’ had non-zero exit status”
Warning message in install.packages("exactextractr"):
“installation of package ‘sf’ had non-zero exit status”
Warning message in install.packages("exactextractr"):
“installation of package ‘exactextractr’ had non-zero exit status”
The package was not installed:
library(exactextractr)
Output:
Error in library(exactextractr): there is no package called ‘exactextractr’
Traceback:
1. library(exactextractr)
What is the problem here?
Do this in one cell - R Colab doesn't support sudo directly.
system('sudo apt install libudunits2-dev')
Then this should work (I tried it successfully)
install.packages("exactextractr")