Scripts and report generator for Wisconsin Lake Reports.
- Open RStudio & the
lakeReport
project - Source the
workflow-functions.R
script - Specify inputs to
makeReports
(see below) - Run
makeReports
Required Inputs for makeReports
function
Input | Type | Description |
---|---|---|
siteNumber |
string value or vector | the USGS station number OR auto |
wy |
numeric value | water year |
plotNames |
string value or vector | the name of the plot type you would like to produce [options: ghtable , stagehydrograph , qwtable , depthprofiles , qwtimeseries , auto ] |
output |
string value | the format you would like the file saved as [options: pdf or word ] |
Optional Inputs for makeReports
function with stagehydrograph
Input | Type | Description |
---|---|---|
filepath |
string value | indicates where your csv is located |
dateTime |
string value | indicates the column name in your csv where dates are stored |
gageHeight |
string value | indicates the column name in your csv where gage heights are stored |
More examples located in workflow-examples.R
.
# single site, single report
wy <- 2014
siteNumber <- '05390500'
plotNames <- 'ghtable'
output <- 'pdf'
makeReports(siteNumber, wy, plotNames, output)
# single site, multiple reports as word
wy <- 2014
siteNumber <- '455638089034501'
plotNames <- c('qwtable', 'depthprofiles', 'qwtimeseries')
output <- 'word'
makeReports(siteNumber, wy, plotNames, output)
# get all plotNames from `plotNames_by_site.csv` for a single site
wy <- 2014
siteNumber <- '05390500'
plotNames <- 'auto'
output <- 'word'
makeReports(siteNumber, wy, plotNames, output)
# run all possible site and plotName combinations from `plotNames_by_site.csv`
# currently makes all 89 combinations in ~ 6 minutes
wy <- 2014
siteNumber <- 'auto'
plotNames <- 'auto'
output <- 'word'
makeReports(siteNumber, wy, plotNames, output)
# use data from a file for stagehydrograph (not using dataRetrieval)
wy <- 2014
siteNumber <- '05390500'
plotNames <- 'stagehydrograph'
makeReports(siteNumber, wy, plotNames, 'pdf',
filePath = 'myfilepath',
dateTime = 'sample_dt',
gageHeight = 'result_va')
- Decide which plot/report type you are going to be debugging.
- Open
workflow-functions.R
,functions-[plotname].R
, and[plotname].Rmd
files. - Source
workflow-functions.R
andfunctions-[plotname].R
using the source button at the top right of your scripts window. - Create the
wy
(numeric) andsiteNumber
(character) objects. You should debug using only one site at a time. - Run all of the
library()
calls in the first chunk of[plotname].Rmd
. - You should now be able to step through each R chunk (greyed out box) of your
[plotname].Rmd
file. - Should you come across a function that you would like to investigate, CTRL+Click the name of the function to navigate there. Then add
browser()
on the line you would like to stop. Save the file and source it again. Be careful with placingbrowser()
insideif-else
structures, unless you truly want to only pause when it meets that specific condition. - Use the
Next
,Continue
, andStop
buttons in theConsole
pane to navigate when in debug mode. - Should you make any changes to the code, make sure to save and source the file. If you make changes to
[plotname].Rmd
, you will only need to save that file and rerun the lines of code. - Before committing your changes, try running the overall report using
makeReports
and check that it looks as you would expect it to.
New to this repo? Fork the master repository and setup remotes before trying to follow these directions.
- Always start by making sure your local code matches what is upstream (ideally, this would happen before you make changes to avoid any merge conflicts). Use
git fetch upstream master
and thengit merge upstream/master
to pull remote changes to your local repository. - Use the "commit" button in your RStudio Git tab. Make sure you have checked the boxes of what you would like to commit. Then select "Commit". Type a message describing the changes, then click "Commit".
- Using the green up arrow, "push" your changes to your remote fork (online).
- Using a web browser, navigate to your remote fork.
- Select "New Pull Request", and then "Create Pull Request"
- Give your pull request (PR) a subject and a small description as necessary. If you are fixing a specific issue, reference that issue using
#
in the body of your PR. Then click "Create Pull Request". - If you would like someone to review, call them out in a comment using
@
or assign the PR to them. Otherwise, click "Merge".
##Installing Packages
install.packages(c("dataRetrieval","dplyr","lubridate","gsplot", "knitr"))
##Disclaimer This software is in the public domain because it contains materials that originally came from the U.S. Geological Survey, an agency of the United States Department of Interior. For more information, see the official USGS copyright policy
Although this software program has been used by the U.S. Geological Survey (USGS), no warranty, expressed or implied, is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith.
This software is provided "AS IS."