knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Rbills
helps you scrape information from PDF files. It is desined to scrape only Rocky Mountain Power
and Summit Energy
documents.
You can use the Rbills
package to:
get_pdf: get all files in a directory or get files that you choose in a directory.
read_pdf_seg: read pdf files from Summit Energy documents.
read_pdf_rmp: read pdf files from Rocky Mountain Power documents.
Theses functions are for use only with the data team and no other people.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("BYUIDSS/Rbills")
library(Rbills)
There are two main ways to use get_pdf
function:
choose.file = FALSE
is default. The following code is an example.path <- system.file("data-raw", package = "Rbills", mustWork = TRUE) get_pdf(path)
choose.file = TRUE
. The following code is an example.path <- system.file("data-raw", package = "Rbills", mustWork = TRUE) get_pdf(path, choose.file = TRUE)
The read_pdf_seg
function only works for Summit Energy
documents. This function provides a table of data that fits the template of a given file. The following code is an example.
path <- system.file("data-raw", package = "Rbills", mustWork = TRUE) # Choose 'example_gasbill' file. x <- get_pdf(path, choose.file = TRUE) gas_table <- read_pdf_seg(path, x) head(gas_table) # If you want to convert to the csv file, use utils::write.csv function. # utils::write.csv(gas_table, "gas_table.csv", row.names = FALSE)
The read_pdf_rmp
function only works for Rocky Mountain Power
documents. This function provides a table of data that fits the template of a given file. The following code is an example.
path <- system.file("data-raw", package = "Rbills", mustWork = TRUE) # Choose 'example_powerbill' file. x <- get_pdf(path, choose.file = TRUE) # Type Bldg 85, Main Bldg, East Bldg, West Bldg 1, West Bldg 2 when prompt function occurs. power_table <- read_pdf_rmp(path, x) head(power_table) # If you want to convert to the csv file, use utils::write.csv function. # utils::write.csv(power_table, "power_table.csv", row.names = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.