knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
OpsumToolbox version 0.1 provides a utility for extracting data from U.S. Coast Guard cutter operational summaries and transforming it into a dataframe for further analysis. To run the development version of this software, you will need to have the devtools
package installed. Then you can run the command:
devtools::install_github("jrh05/opsumToolbox")
This command will install the latest stable version of the package from github, and it will also install the package dependencies plyr
and dplyr
if they are not already installed. The example below utilizes the readtext
and quanteda
packages.
library(readtext) library(quanteda) library(opsumToolbox) opsum.dir <- system.file("extdata", package = "opsumToolbox") OPSUMS <- readtext(opsum.dir) corpus_txt <- corpus(OPSUMS) docnames(corpus_txt) <- OPSUMS$doc_id x <- texts(corpus_txt) y <- cgOpsum(x) z <- data.frame.cgOpsum.list(y) #z$DTG.START <- DTG(z$`PERIOD COVERED.START`) #z$POSIXUTC.START <- as.POSIXct(z$DTG.START, tz = "GMT") #z <- z[order(z$POSIXUTC.START), ] #z[, c("PERIOD COVERED.START", "CO COMMENTS")] #z[, c("MSG DTG", "PERIOD COVERED.START", "DTG.START", "POSIXUTC.START")]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.