| getWData | R Documentation |
Gets data from Characteristic objects and formats it for ease in analysis.
getWData(
object,
parkcode = NA,
sitecode = NA,
charname = NA,
category = NA,
mindate = NA,
maxdate = NA,
months = NA,
years = NA,
wyears = NA,
minvalue = NA,
maxvalue = NA,
minobs = 1,
output = "dataframe"
)
object |
Either a |
parkcode |
One or more parkcodes, in quotes. If |
sitecode |
One or more sitecodes, in quotes. If |
charname |
Name of one or more characteristics, in quotes. Only those characteristics will be returned. |
category |
One or more categories of characteristics, in quotes. Only those categories of characteristics will be returned. |
mindate |
The earliest date of data to include, in quotes. Date is in the same format as the |
maxdate |
The latest date of data to include, in quotes. Date is in the same format as the |
months |
A numeric vector corresponding to months of the year. Only data from those months will be returned. |
years |
A numeric vector corresponding to calendar years. Only data from those months will be returned. |
wyears |
A numeric vector corresponding to water years. Only data from those water years will be returned. |
minvalue |
A number, indicating that only measurements with values greater than or equal to |
maxvalue |
A number, indicating that only measurements with values less than or equal to |
minobs |
An integer indicating the minimum number of observations needed for a dataset to be returned. T his is assessed after the other filters are applied. Defaults to 0. |
output |
Either "dataframe", the default, or "list". Determines the type of output when data from more than one
characteristic or site are returned. If |
This function is intended to be the primary method for accessing water data. Data from various objects (see below)
is combined into a single data.frame along with columns indicating which park/site/characteristic the data is from.
If object is a Characteristic object getWData will return a data.frame with columns
consisting of Date and Value from the Data slot as well as a column named Characteristic
with the data from the charname slot. and a column named Category iwth data from the category slot.
If object is a Site object it will return a data.frame that also includes a column named Site
which comes from the SiteCode slot. If object is a Park object then a column named Park is
included which comes from the ParkCode slot.
Data can be filtered in a variety of ways. A date range can be selected by using the mindate and/or maxdate
arguments. Dates passed to these arguments must be in text format and the same format as the dates in the data. The months
argument will filter for data from one or more months. This argument requires months to be listed as one or more integers,
e.g. months=c(3,4) will return only data collected in March or April. If NA is passed to
months (the default), or NA is an element of the vector passed to months then data from all months
will be returned. The years argument works in the same way, except that it only returns data from specific years.
The wyears argument is the similar to years except that it filters by "water year". USGS water years start
on October 1st and end on September 30th, so water year 2010 went from October 1st 2009 through September 30th 2010.
If an Characteristic object has an empty data slot, or the filtering options are such that no data meets the criteria,
then the function returns NULL. NULL is also returned if after filtering there are fewer observations
than minobs. This can be useful when getting data for analysis or graphics and you only wish to use datasets with
sufficient observations.
A data.frame or list based on the Data slot of Charactersitic objects.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.