Having scripts or code that perform elements of processing or analysis is an essential step in making our work robust and repeatable. However not having control of individual function versions when copied from one work project to the next becomes problematic on many levels:
So in light of this it's time to release the Remote Sensing and Spatial Analysis section's own software package, RSSApkg.
This is a great strength of R and enables us to wrap up individual functions
with associated help files and "How To" vignettes in an easily distributable
and versioned bundle. Think of a package as a "toolbox" that contains a whole
heap of interrelated tools that can be used on a task. Even if you are a casual
user of R you will have come into contact with packages every time you run a
library()
command at the top of a script.
The benefits of our package will be:
If you are using R Studio on the server then it is already installed you just need to load it.
library(RSSApkg)
If you are working on your own computer then you may need to install it first. The package is only available to install from the RSSA's own Git Hub project (yes that's right we have our own!) and to download it you need another package to help with this.
#install devtools from CRAN if you don't already have it install.packages("devtools") #install and load RSSApkg devtools::install_github("RSPaW/RSSApkg") library(RSSApkg)
I will always send around an email heads up if the package has been updated and let you know what's changed. If you are working on the server then its just nice to know. If however you like working on your own computer then it's your cue to re-install with the method outlined above.
Easy huh?
As previously mentioned there is help available for all the functions in the package.
If you know the name of the function you want help with, in the console window
type help("function name")
. This will open the help file for that function and
if working in R Studio, will open it in the help pane.
Another great feature in R Studio is that there is an auto-complete so when typing out the function name it will try to guess the function name and show what the function arguments are.
Firstly click on the Packages tab and scroll down the available packages until you find the RSSApkg.
This has the benefit of showing you all the help files available. Next you click on the one you want.
Detailed documentation is then displayed.
Housing and distributing packages from Git Hub has a nice side benefit and that is that a package website can easily be created. There are a number of ways to get to it. You can click here and there is always a link at the bottom of the help files accessed via the two methods outlined above. The benefits of the website are:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.