SensusR is a package written for the R Statistical Computing Environment. The purpose of SensusR is to make ingest, analysis, and visualization of Sensus data straightforward.
There are several options for installing SensusR.
SensusR is available directly through CRAN, but you should
probably install it via the usual method (
install.packages on the command line or through the menu system in RStudio).
You can also obtain source packages for SensusR directly from the Sensus GitHub repository. If you download one of these source archives, use the following command to install the package, editing the path appropriately for your machine:
install.packages("/path/to/SensusR_VERSION.tar.gz", repos = NULL, type = "source")
In the above command, VERSION is the SensusR version that you are installing. After installation, call
load the package and see the package help for details on available functions and their use. Some notes on these releases follow:
- 2.1.0: In order to plot location data, you'll need to reinstall the
ggmappackage from source with
install.packages("ggmap", type = "source").
Obtaining Sensus Data
The approach to obtaining your Sensus data will depending on how you have configured your Protocol. In particular, it will depend on your choice of LocalDataStore, RemoteDataStore, and configuration of each. We typically use the AmazonS3RemoteDataStore.
The following steps were adapted from http://www.r-bloggers.com/how-to-check-your-package-with-r-devel.
sudo pkgutil --forget org.r-project.R.XXXX.fw.pkgso that the installer does not overwrite your current R installation. In this command,
XXXXis your Mac OS version. This can be found with
pkgutil --packages | grep r-project.
- Rename your R.app and R64.app or move them temporarily into another folder, as the installer of R-devel probably will replace them by new version that are not compatible with your existing stable R version.
- Install R-devel if you haven't already.
- Install RSwitch.
- Use RSwitch to change to your normal version of R and then build the SensusR source package within RStudio via Build > Build
Source Package. Move the resulting package to the
- Use RSwitch to change to R-devel.
- Install packages which your own packages depends on. You have to do it from source, as the binaries for the R-devel do not
exist. As of SensusR 2.0.0 this command is
install.packages(c("jsonlite","lubridate","plyr","sp","ggmap","ggplot2"), type = "source"). Note that ggplot2 requires the jpeg package. In order to install the latter from source you first need to install jpeg via Homebrew using
brew install jpeg.
- Check the package:
R CMD check SensusR/Releases/SensusR_2.0.0.tar.gz --as-cran