Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
technical:recipes:r-in-rlibs [2020-09-05 10:48] anitatechnical:recipes:r-in-rlibs [2020-09-05 12:51] (current) – [VALET Package for R Packages] anita
Line 144: Line 144:
 library(quantregForest) library(quantregForest)
 install.packages("car", type = "source", configure.args=c('--with-proj-lib=/opt/shared/proj/5.1.0/lib', '--with-proj-include=/opt/shared/proj/5.1.0/include'), dependencies = TRUE) install.packages("car", type = "source", configure.args=c('--with-proj-lib=/opt/shared/proj/5.1.0/lib', '--with-proj-include=/opt/shared/proj/5.1.0/include'), dependencies = TRUE)
 +install.packages("units", type = "source", configure.args=c('--with-udunits2-lib=/opt/shared/udunits/2.2.26/lib', '--with-udunits2-include=/opt/shared/udunits/2.2.26/include'), dependencies=TRUE)
 +library(units)
 install.packages("rgdal", type = "source", configure.args=c('--with-proj-lib=/opt/shared/proj/5.1.0/lib', '--with-proj-include=/opt/shared/proj/5.1.0/include'), dependencies = TRUE) install.packages("rgdal", type = "source", configure.args=c('--with-proj-lib=/opt/shared/proj/5.1.0/lib', '--with-proj-include=/opt/shared/proj/5.1.0/include'), dependencies = TRUE)
 +library(rgdal)
 install.packages("rasterVis", type = "source", configure.args=c('--with-proj-lib=/opt/shared/proj/5.1.0/lib', '--with-proj-include=/opt/shared/proj/5.1.0/include'), dependencies = TRUE) install.packages("rasterVis", type = "source", configure.args=c('--with-proj-lib=/opt/shared/proj/5.1.0/lib', '--with-proj-include=/opt/shared/proj/5.1.0/include'), dependencies = TRUE)
 library(rasterVis) library(rasterVis)
 install.packages("raster", type = "source", configure.args=c('--with-proj-lib=/opt/shared/proj/5.1.0/lib', '--with-proj-include=/opt/shared/proj/5.1.0/include'), dependencies = TRUE) install.packages("raster", type = "source", configure.args=c('--with-proj-lib=/opt/shared/proj/5.1.0/lib', '--with-proj-include=/opt/shared/proj/5.1.0/include'), dependencies = TRUE)
-install.packages("units", type = "source", configure.args=c('--with-udunits2-lib=/opt/shared/udunits/2.2.26/lib', '--with-udunits2-include=/opt/shared/udunits/2.2.26/include'), dependencies=TRUE) 
-library(units) 
 install.packages("sf", dependencies = TRUE) install.packages("sf", dependencies = TRUE)
 library(sf) library(sf)
Line 177: Line 178:
  
 === Review Installation Output === === Review Installation Output ===
-Review the generated output file, ''install-spatial-09052020.Rout'', for details on each package installation. If there are errors, fix the install R script and rerun.  If a package was successfully downloaded and installed, it will not redo it again, it will see the package exists and will pick up where it left off.+Review the generated output file, ''install-spatial-09052020.Rout'', for details on each package installation. If there are errors, fix the install R script and rerun. 
  
 === Final List of R packages Installed === === Final List of R packages Installed ===
Line 195: Line 196:
 ==== VALET Package for R Packages ==== ==== VALET Package for R Packages ====
  
-Last step is to create a VALET package to load the correct version of R and your newly installed R packages.  The easiest way to do this is to copy the VALET package for the version of R you used for the installation, add your R_LIBS and load the dependent packages.  For this recipe, we will call the VALET package ''spatial-r.vpkg_yaml'' +Last step is to create a VALET package to load the correct version of R and your newly installed R packages.  The easiest way to do this is to copy the VALET package for the version of R you used for the installation, add your R_LIBS and load the dependent packages.  For this recipe, we will call the VALET package ''spatial-r.vpkg_yaml'' and it should be put in the workgroup ''sw'' directory in ''valet'' so it will be found when using your workgroup.
  
 <code bash> <code bash>
-more spatial-r.vpkg_yaml+[(it_css:traine)@login01 valet]pwd 
 +/work/it_css/sw/valet 
 +[(it_css:traine)@login01 valet]$ cat spatial-r.vpkg_yaml
 spatial-r: spatial-r:
   description:       The Comprehensive R Archive Network   description:       The Comprehensive R Archive Network
Line 229: Line 232:
           value:        /work/it_css/sw/r/add-ons/r3.5.1/spatial-09052020/default           value:        /work/it_css/sw/r/add-ons/r3.5.1/spatial-09052020/default
 </code> </code>
 +
 +==== Testing R packages ====
 +
 +Now that you have installed your R packages, let's test by using VALET to setup our new environment by first clearing it and then using our new VALET package
 +
 +<code bash>
 +[(it_css:traine)@login01 ~]$ vpkg_rollback all
 +[(it_css:traine)@login01 ~]$ vpkg_require spatial-r
 +
 +</code>
 +
 +
  • technical/recipes/r-in-rlibs.1599317334.txt.gz
  • Last modified: 2020-09-05 10:48
  • by anita