To install STRbook in R, first install devtools and then run:
The package SpatioTemporal
The package SpatioTemporal, needed for Lab 4.3, is no longer available on CRAN. To install it, please download the source package from:
Then, in the R console, type:
, type = 'source', repos = NULL)
Note that on Windows machines, RTools needs to be installed to compile this package from source.
Below we provide R code for all the Labs in the book:
Note that these Labs are only guaranteed to run and give the expected results with the package versions current of 2019. If you are having trouble running any of the Labs, we recommend trying to run the Labs on our online platform, which uses the required package versions, or to download the updated raw Sweave files that have been updated to account for newer versions of other packages that the Labs call. See below for further details.
Run the R Labs in your browser!
If you want to use the Labs with the same packages that were used when compiling our book in 2019, you can run them in your browser by simply clicking here. This link will load RStudio (slowly the first time) in your browser; you will find all the Labs in the "scripts" folder (look at the bottom-right hand side of the RStudio panel). Click on "scripts," then double click on a script to open it, and advance through it line-by-line (press Ctrl+Enter successively to do this quickly) to enter it into the Console below. Just pressing the "Source" button at the top to run the Lab immediately doesnot always work. Note that a couple of Labs that run FRK have been changed slightly from the original version, to satisfy memory limits on this online platform (a warning is issued so you know where we did the change). The online platform uses packages that were current when the book was published in 2019, and so all Labs should run without any problems. The platform may take a while to load the first time you click on it, but it is worth the wait!
We would like to thank Zhonghua Zheng for coming up with the idea and making the initial prototype, and Yi Cao for ironing out the wrinkles and verifying that all Labs can run.
Raw Sweave code for the Labs on github (Live Labs)
We have made the raw Sweave (.Rnw) files for the Labs available on this github page. In order for these Labs to be independent from the rest of the book, they are compiled with a standalone switch set to TRUE. This switch mainly rewords sentences that refer to places in the book so that there are no broken references in the compiled documents.
The Labs on the github page are meant to be Live Labs, in the sense that they should work with the latest R packages. Users are also invited to contribute to the Labs by providing suggestions, fixes, and/or Lab extensions through pull requests.
Code for Linked Brushing that was used in the book (see Section 2.3.4) is available here. This code, which runs with ggvis, may now have issues with linking. A new Shiny app that just uses ggplot2 brushes is available here.