Learn R Programming

dataRetrieval (version 2.7.11)

renameNWISColumns: renameColumns

Description

Rename columns coming back from NWIS data retrievals. Daily and unit value columns have names derived from their data descriptor, parameter, and statistic codes. This function reads information from the header and the arguments in the call to to rename those columns.

Usage

renameNWISColumns(
  rawData,
  p00010 = "Wtemp",
  p00045 = "Precip",
  p00060 = "Flow",
  p00065 = "GH",
  p00095 = "SpecCond",
  p00300 = "DO",
  p00400 = "pH",
  p62611 = "GWL",
  p63680 = "Turb",
  p72019 = "WLBLS",
  ...
)

Arguments

rawData

the daily- or unit-values datset retrieved from NWISweb.

p00010

the base name for parameter code 00010.

p00045

the base name for parameter code 00045.

p00060

the base name for parameter code 00060.

p00065

the base name for parameter code 00065.

p00095

the base name for parameter code 00095.

p00300

the base name for parameter code 00300.

p00400

the base name for parameter code 00400.

p62611

the base name for parameter code 62611.

p63680

the base name for parameter code 63680.

p72019

the base name for parameter code 72019.

named arguments for the base name for any other parameter code. The form of the name must be like pXXXXX, where XXXXX is the parameter code.

Value

A dataset like data with selected columns renamed.

See Also

readNWISdv, readNWISuv

Examples

Run this code
# NOT RUN {
siteWithTwo <- '01480015'
startDate <- "2012-09-01"
endDate <- "2012-10-01"
# }
# NOT RUN {
twoResults <- readNWISdv(siteWithTwo, "00060",startDate,endDate)
names(twoResults)
renamedCols <- renameNWISColumns(twoResults)
names(renamedCols)
#Custom names:
newNames <- renameNWISColumns(twoResults, p00060="Discharge")
names(newNames)
# }

Run the code above in your browser using DataLab