Description Usage Arguments Value Note See Also Examples
Function to identify and fix common problems with hydrologic data
1 |
dataset |
is a data frame in format of the data frame returned by importDVs. |
task |
is either "view" or "fix." View will return a list containing rows with negative values and rows with missing values. Fix will replace negative values with NA and replace zeroes with the value specified by the replace argument. |
replace |
is the value used to replace 0 values. The default is 0.1. For streamflow in small streams, one might want to use 0.01. For daily data other than streamflow, such as turbidity, users may not want to replace 0 values with a nonzero value. In those cases, replace can be set to 0. |
A list showing days with negative values and days with values of 0 when task is "view." When task is "fix" the fixed dataset is returned. When a negative value is replaced with NA, an "N" is added to the qualcode field to indicate that there had been a negative number. When a zero value is replaced, an "R" is added to the qualcode field to indicate that a zero value was replaced.
If calculating anomalies (see compAnom), the user may need to replace isolated missing values with with a value; however, if there are larger periods with missing values, streamflow anomalies may not be an appropriate use of the data. The substitution of some missing data with values may be done using the function fillMiss that is part of this package. However, care needs to be taken when filling in missing data.
fillMiss
1 2 3 4 5 6 7 8 9 10 | data(exampleWaterData)
head(badDataSet)
cleanUp(badDataSet, task="view")
q05054000Fix <- cleanUp(badDataSet, task="fix")
# replace 0s with NA, then one could use the fillMiss function
# to estimate values
q05054000Fix2 <- cleanUp(badDataSet, task="fix", replace=NA)
summary(badDataSet)
summary(q05054000Fix)
summary(q05054000Fix2)
|
staid val dates qualcode
1 05054000 470 2000-01-01 A e
2 05054000 470 2000-01-02 A e
3 05054000 470 2000-01-03 A e
4 05054000 460 2000-01-04 A e
5 05054000 460 2000-01-05 A e
6 05054000 460 2000-01-06 A e
[[1]]
staid val dates qualcode
3979 05054000 -999999 2010-11-22 P Ice e
[[2]]
staid val dates qualcode
1365 05054000 0 2003-09-26 A
1366 05054000 0 2003-09-27 A
1367 05054000 0 2003-09-28 A
staid val dates qualcode
05054000:4018 Min. :-999999 Min. :2000-01-01 A :2664
1st Qu.: 523 1st Qu.:2002-10-01 A e :1273
Median : 923 Median :2005-07-01 P : 41
Mean : 1548 Mean :2005-07-01 P Ice e: 1
3rd Qu.: 1900 3rd Qu.:2008-03-31 P e : 39
Max. : 29100 Max. :2010-12-31
staid val dates qualcode
05054000:4018 Min. : 0.1 Min. :2000-01-01 A :2661
1st Qu.: 523.0 1st Qu.:2002-10-01 A R : 3
Median : 923.0 Median :2005-07-01 A e :1273
Mean : 1797.0 Mean :2005-07-01 P : 41
3rd Qu.: 1900.0 3rd Qu.:2008-03-31 P Ice e N: 1
Max. :29100.0 Max. :2010-12-31 P e : 39
NA's :1
staid val dates qualcode
05054000:4018 Min. : 51.0 Min. :2000-01-01 A :2661
1st Qu.: 524.0 1st Qu.:2002-10-01 A R : 3
Median : 924.5 Median :2005-07-01 A e :1273
Mean : 1798.3 Mean :2005-07-01 P : 41
3rd Qu.: 1900.0 3rd Qu.:2008-03-31 P Ice e N: 1
Max. :29100.0 Max. :2010-12-31 P e : 39
NA's :4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.