| importQW | R Documentation |
Converts a dataset containing stacked discrete water-quality sample data to a dataset representing those data as class "qw."
importQW(data, keep = c("STAID", "DATES", "TIMES", "MEDIM"),
values = "VALUE", remark.codes = "REMRK", value.codes = "NWIS",
reporting.level = "RPLEV", reporting.method = "RLTYP",
reporting.units = "UNITS", analyte.method = "METHD",
analyte.name = "PSNAM", unique.code = "PCODE", ColNames = "Auto")
data |
the dataset. |
keep |
the names of the columns that represent a single sample and any other common information. |
values |
the name of the column containing the reported numeric values. |
remark.codes |
he name of the column containing the remark codes. |
value.codes |
the name of the column containing any value modifiers, or the character string to use. See Details. |
reporting.level |
the name of the column containing the reporting level, or the numeric value to use. See Details. |
reporting.method |
the name of the column containing the type of the reporting level, or the character string to use. See Details. |
reporting.units |
the name of the column containing the measurement units, or the character string to use. See Details. |
analyte.method |
the name of the column containing the analytic method, or the character string to use. See Details. |
analyte.name |
the name of the column containing the name of the analyte, or the character string to use. See Details. |
unique.code |
the name of the column containing any unique codes, or the character string to use. See Details. |
ColNames |
the name of the column containing the column name to use to
make column names, the character string to use if only a single analyte, or
"Auto" if the data in |
Only values and remark.codes are required. All others can be
interpreted as constant values if the column name is not in data. For
automatic generation of column names, see makeColNames.
For reporting.level, it is better to use NA than to use an
arbitrary small value because the functions to convert to objects for analysis
will create reasonable reporting level values if they are not known.
For other columns when the actual value is not known, the actual value
is less important for analysis and more important for the user, so
arbitrary values can be used.
A data frame containing the columns in keep and those
generated by converting the other columns into class "qw."
Need some notes
Lorenz, D.L., 2014, USGSqw OFR.
See information about discrete
samples at https://nwis.waterdata.usgs.gov/usa/nwis/qw.
readNWISqw, importNWISqw,
makeColNames
## Not run:
# Convert the stacked qw data supplied in smwrData
library(smwrData)
data(QWstacked)
QWstacked$result_va <- as.numeric(QWstacked$result_va) # raw data are character
# The units are both mg/l, no analyte name, generate column names from parameter codes
head(importQW(QWstacked, c("site_no", "sample_dt", "sample_tm", "medium_cd"),
"result_va", "remark_cd", "val_qual_tx", "rpt_lev_va", "rpt_lev_cd",
"mg/l", "meth_cd", "", "parm_cd", "parm_cd"))
# A simple example having the minimum information
data(QW05078470)
importQW(QW05078470, c("DATES", "TIMES"), "P00665", "R00665", "", 0.005, "User",
"mg/l", "Unk", "Dissolved Phosporus", "00665", "DissP")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.