This repository contains the official GeyserTimes R package. It is designed to facilitate easy access to the data hosted at GeyserTimes using the R language. It primarily targets researchers and supports the following functionality.
You can install the latest released version from CRAN with:
install.packages("geyertimes")
Or install the latest development version from GitHub with:
# install.packages("devtools")
::install_github("geysertimes/geysertimes-r-package") devtools
Here’s a quick example to get you going. We’ll be plotting a very
simple histogram of the last 500 eruptions of Old Faithful. First, we
need to download and retrieve the archive data, which will be installed
locally at the location given by gt_path()
.
library(geysertimes)
gt_get_data(dest_folder = gt_path()) # Download the data
<- gt_load_eruptions() # Load the tibble eruptions
At this point, we have the full archive of eruptions. We first filter it to only contain Old Faithful eruptions that are primary. Then, we sort it descending by eruption time and add the interval column as the time difference between two subsequent rows.
# install.packages("dplyr")
library(dplyr)
<- eruptions %>%
oldfaithful filter(geyser == "Old Faithful", eruption_id == primary_id) %>%
arrange(desc(time)) %>%
mutate(interval = lag(time) - time)
Finally, we’ll take the last 500 intervals and plot this with R’s base histogram functionality. Note that you can likely achieve better-looking charts, this is for demonstration only.
<- slice(oldfaithful, 2:501)
last500 hist(as.numeric(last500$interval), breaks = 250,
main = "Old Faithful Intervals", xlab = "Interval [seconds]",
xlim = c(3400, 7200))