maxObs | R Documentation |
Tests values in a CRHMr obs data frame to see if they exceed maximum
thresholds. Values exceeding the thresholds can be set to either the maximum allowable
value or to NA_real_
, which is useful for infilling or imputing values.
maxObs(
obs,
varcols = "",
maxvals = "",
actions = "max",
quiet = TRUE,
logfile = ""
)
obs |
Required. The CRHMr obs data frame. |
varcols |
Optional. A vector containing the columns to be imputed in the obs data frame, not including the datetime. If not specified, defaults to all columns. |
maxvals |
Optional. A vector containing the maximum permissible values for each of the specified columns. If omitted, the default values are used. |
actions |
Optional. A vector containing the methods to be used for replacing values
that exceed the maximum threshold values. Currently supported actions are max
(using the threshold) and NA (inserting |
quiet |
Optional. Suppresses display of messages, except for errors. If you are
calling this function in an R script, you will usually leave |
logfile |
Optional. Name of the file to be used for logging the action. Normally not used. |
If successful, returns a modified version of the obs data frame. The values
exceeding the specified max
values are replaced by either NA_real_
or the
threshold max
values. If unsuccessful, returns the value FALSE
.
The default threshold values are
t | 40 C |
ea | 3.5 kPa |
rh | 100 percent |
ppt | 100 mm |
p | 20 mm |
u | 10 m/s |
SunAct | 18 hr |
qsi | 1262 W/m^2 |
qso | 1000 W/m^2 |
qn | 250 W/m^2 |
Kevin Shook
minObs
# use all of the default values
bad.max <- maxObs(BadLake7376)
summary(bad.max)
# use specified columns with default max values, replace with 'NA' values
bad.max2 <- maxObs(BadLake7376, varcols = c(1, 2), actions = "NA")
# use specfied columns with specified max values and actions
bad.max3 <- maxObs(BadLake7376, maxvals = c(35, 10), varcols = c(1, 3), actions = c("NA", "max"))
summary(bad.max3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.