Learn R Programming

ie2misc (version 0.8.6)

qw: qw, qw2 and qwBATCH

Description

qw, qw2 and qwBATCH process raw QW files. The QW files can contain "selected water-quality data for stations in the U.S. Geological Survey (USGS) National Water Information System (NWIS) water-quality database. The data you have secured from the USGS NWISWeb database may include data that have not received Director's approval and as such are provisional and subject to revision."

Usage

qw(
  file = tk_choose.files(default = "", caption =
    "Select file(s) to open & hold down Ctrl to choose more than 1 file", multi = TRUE,
    filters = matrix(c("QW file", "*", "QW file", ".rdb", "QW file", ".RDB"), 6, 2, byrow
    = TRUE)),
  interactive = TRUE,
  overwrite = TRUE
)

qwBATCH( path = tk_choose.dir(caption = "Select directory with the QW files"), pattern = "*.rdb", overwrite = TRUE )

qw2(file, overwrite = TRUE)

Arguments

file

Input QW file(s) to be selected through a file dialog.

interactive

If interactive is TRUE, then the user will select the filenames(s) to use for saving with the file dialog. In order to select more than one file, the user must hold down the Ctrl (Control) button while mouse clicking the chosen files. If interactive is FALSE, then the user will select the directory, via the directory dialog, to use for saving and the original filenames will be used.

overwrite

If TRUE, overwrite any existing spreadsheet.

path

Directory path of QW files to be selected through a directory dialog. The user will be asked where to find the QW files & then the user will be asked where to save the QW .xlsx files.

pattern

The default pattern is .rdb (the filename has the .rdb extension). This pattern can be changed by qwBATCH(pattern = "pattern").

Value

QW .xlsx file(s).

Details

qw function opens a single or multiple raw, QW file(s) to modify the format and then exports the file(s) in .xlsx format. This is done for a single file or multiple files that the user selects with a file dialog.

qw2 function opens a single QW file to modify the format and then exports the file in .xlsx format. This is done for a single file that the user selects without a file dialog.

qwBATCH function opens raw QW files, from a directory, to modify the format and then exports the files in .xlsx format. This is done in a BATCH mode (whole directory of QW files) using a directory dialog.

qw, qw2 and qwBATCH functions perform the same processes on the raw QW files: 1) remove the first row, 2) create a single column with the Date and Time rather than 2 separate Date and Time columns (if needed), and 3) exports the QW file as a spreadsheet with three sheets (sheet1 corrects the timezones for Daylight Savings Times, sheet2 includes everything except for the meta data, and sheet3 provides the meta data from the top of the file). The supported US timezones are the following: Eastern, Central, Mountain, Pacific, Alaska, Hawai'i, and Atlantic (Puerto Rico and US Virgin Islands).

Examples

Run this code
# NOT RUN {
library("ie2misc")
# Examples to change (an) QW file(s) interactively and non-interactively
file1 <- "https://waterdata.usgs.gov/nwis/dv?cb_00060=on&format=rdb&site_no=03584500"
file2 <- "&period=&begin_date=1904-07-01&end_date=2016-06-22"
file3 <- paste0(file1, file2) # used to truncate the file name
qw2(file3)
# USGS 03584500 ELK RIVER NEAR PROSPECT, TN
# Discharge, cubic feet per second (Mean)



qw() # default where interactive = TRUE
# Follow the file dialog instructions


qw(interactive = FALSE)
# Follow the file dialog instructions


# Example to change QW files in batch mode
qwBATCH()
# Follow the file dialog instructions
# }
# NOT RUN {


# }

Run the code above in your browser using DataLab