Sunday, December 4, 2022

Completing Removing a Git Submodule

This is a note about removing  a Git submodule completely.

  1. Revise the .gitmodules by removing the reference to the submodule Git repo;
  2. Revise the .git/config file by removing the reference to the submodule Git repo;
  3. Remove the submodule from Git index, e.g.,
        git rm --cached path_to_submodule
    
  4. Delelete the meta data from .git directory, by removing .git/module/path_to_submodule
  5. Stage the changes, and commit the changes, e.g.,
        git add -u
        git commit -m "removed the submodule"
        

Reference

The above is a summary from these references

Friday, December 2, 2022

Installing R Packages in User Space on Linux

On a Linux system, without running R as the root user, we can install R packages and libraries in the user space. By default, the installation directory is $HOME/R/library. What if we want to install it to a different directory without having to specifying it on the R command line? For this, we can set R_LIBS environment variables to point to the directory. For instance, if we wish to install the libraries to a hidden directory, e.g., the $HOME/.R/library directory, we can set it up in the user profile, such as, in the .profile or .bash_profile file,


if [ -n $R_LIBS ]; then
  R_LIBS="/home/hchen/.R/library":${R_LIBS}
else
  R_LIBS="/home/hchen/.R/library"
fi
export R_LIBS



Installing devtools and landmap in R

It took me several trial and error to install the devtools package and the landmap package from Github repo. This is a note about the installation procedure on Fedora Linux so that we don't have to repeat the trial and error process. 



sudo dnf install  \
		freetype-devel \
		libpng-devel \
        libtiff-devel \
        libjpeg-turbo-devel \
		gdal-devel \
		gdal-libs \
		proj-devel \
		geos-devel \
		udunits2-devel

Then in R,


install.packages('devtools')
library(devtools)
install_github('envirometrix/landmap')