Create a table of the changes in flow-normalized values between various points in time in the record
Source:R/tableChange.R
, R/tableChangeSingle.R
tableChange.Rd
These tables describe trends in flow-normalized concentration and in flow-normalized flux. They are described as changes in real units or in percent and as slopes in real units per year or in percent per year. They are computed over pairs of time points. These time points can be user-defined or they can be set by the program to be the final year of the record and a set of years that are multiples of 5 years prior to that. tableChangeSingle is a version of the same code that will produce output only for flow-normalized concentration or flow-normalized flux, but not both
Usage
tableChange(eList, fluxUnit = 9, yearPoints = NA)
tableChangeSingle(eList, fluxUnit = 9, yearPoints = NA, flux = FALSE)
Arguments
- eList
named list with at least the Daily and INFO dataframes
- fluxUnit
object of fluxUnit class.
printFluxUnitCheatSheet
, or numeric represented the short code, or character representing the descriptive name.- yearPoints
numeric vector listing the years for which the change or slope computations are made, they need to be in chronological order. For example yearPoints=c(1975,1985,1995,2005), default is NA (which allows the program to set yearPoints automatically)
- flux
logical if TRUE results are returned in flux, if FALSE concentration. Default is set to FALSE.
Value
dataframe with Year1, Year2, change[mg/L], slope[mg/L], change[percent], slope[percent] columns. The data in each row is the change or slope calculated from Year1 to Year2
Examples
eList <- Choptank_eList
# Water Year:
# \donttest{
tableChange(eList, fluxUnit = 8, yearPoints = c(1980, 1995, 2011))
#>
#> Choptank River
#> Inorganic nitrogen (nitrate and nitrite)
#> Water Year
#>
#> Concentration trends
#> time span change slope change slope
#> mg/L mg/L/yr % %/yr
#>
#> 1980 to 1995 0.2 0.013 20 1.3
#> 1980 to 2011 0.45 0.015 45 1.5
#> 1995 to 2011 0.26 0.016 21 1.3
#>
#>
#> Flux Trends
#> time span change slope change slope
#> 10^3 kg/yr 10^3 kg/yr /yr % %/yr
#> 1980 to 1995 27 1.8 26 1.7
#> 1980 to 2011 42 1.4 39 1.3
#> 1995 to 2011 15 0.92 11 0.69
tableChange(eList, fluxUnit = 5)
#>
#> Choptank River
#> Inorganic nitrogen (nitrate and nitrite)
#> Water Year
#>
#> Concentration trends
#> time span change slope change slope
#> mg/L mg/L/yr % %/yr
#>
#> 1981 to 1986 0.039 0.0079 3.9 0.79
#> 1981 to 1991 0.14 0.014 14 1.4
#> 1981 to 1996 0.21 0.014 21 1.4
#> 1981 to 2001 0.27 0.013 27 1.3
#> 1981 to 2006 0.36 0.015 36 1.5
#> 1981 to 2011 0.46 0.015 46 1.5
#> 1986 to 1991 0.1 0.021 10 2
#> 1986 to 1996 0.18 0.018 17 1.7
#> 1986 to 2001 0.23 0.015 22 1.5
#> 1986 to 2006 0.32 0.016 31 1.6
#> 1986 to 2011 0.42 0.017 40 1.6
#> 1991 to 1996 0.07 0.014 6.2 1.2
#> 1991 to 2001 0.13 0.013 11 1.1
#> 1991 to 2006 0.22 0.015 19 1.3
#> 1991 to 2011 0.31 0.016 27 1.4
#> 1996 to 2001 0.055 0.011 4.5 0.91
#> 1996 to 2006 0.15 0.015 12 1.2
#> 1996 to 2011 0.24 0.016 20 1.3
#> 2001 to 2006 0.094 0.019 7.4 1.5
#> 2001 to 2011 0.19 0.019 15 1.5
#> 2006 to 2011 0.095 0.019 7 1.4
#>
#>
#> Flux Trends
#> time span change slope change slope
#> tons/yr tons/yr /yr % %/yr
#> 1981 to 1986 12 2.4 10 2
#> 1981 to 1991 24 2.4 20 2
#> 1981 to 1996 29 1.9 24 1.6
#> 1981 to 2001 35 1.8 29 1.5
#> 1981 to 2006 43 1.7 36 1.4
#> 1981 to 2011 44 1.5 37 1.2
#> 1986 to 1991 12 2.5 9.4 1.9
#> 1986 to 1996 17 1.7 13 1.3
#> 1986 to 2001 23 1.5 18 1.2
#> 1986 to 2006 31 1.5 23 1.2
#> 1986 to 2011 32 1.3 24 0.97
#> 1991 to 1996 4.7 0.94 3.3 0.65
#> 1991 to 2001 11 1.1 7.5 0.75
#> 1991 to 2006 19 1.2 13 0.86
#> 1991 to 2011 20 0.98 14 0.68
#> 1996 to 2001 6.1 1.2 4.1 0.82
#> 1996 to 2006 14 1.4 9.4 0.94
#> 1996 to 2011 15 1 10 0.67
#> 2001 to 2006 7.9 1.6 5.1 1
#> 2001 to 2011 8.9 0.89 5.8 0.58
#> 2006 to 2011 1.1 0.21 0.65 0.13
# Winter:
eList <- setPA(eList, paStart = 12, paLong = 3)
tableChange(eList, fluxUnit = 8, yearPoints = c(1980, 1995, 2011))
#>
#> Choptank River
#> Inorganic nitrogen (nitrate and nitrite)
#> Season Consisting of Dec Jan Feb
#>
#> Concentration trends
#> time span change slope change slope
#> mg/L mg/L/yr % %/yr
#>
#> 1980 to 1995 0.2 0.013 18 1.2
#> 1980 to 2011 0.46 0.015 42 1.3
#> 1995 to 2011 0.26 0.016 20 1.3
#>
#>
#> Flux Trends
#> time span change slope change slope
#> 10^3 kg/yr 10^3 kg/yr /yr % %/yr
#> 1980 to 1995 37 2.5 24 1.6
#> 1980 to 2011 59 1.9 38 1.2
#> 1995 to 2011 22 1.4 12 0.72
# Water Year:
eList <- setPA(eList, paStart = 10, paLong = 12)
#This returns concentration ASCII table in the console:
tableChangeSingle(eList, fluxUnit = 8, yearPoints = c(1980, 1995, 2011), flux = FALSE)
#>
#> Choptank River
#> Inorganic nitrogen (nitrate and nitrite)
#> Water Year
#>
#> Concentration trends
#> time span change slope change slope
#> mg/L mg/L/yr % %/yr
#>
#> 1980 to 1995 0.2 0.013 20 1.3
#> 1980 to 2011 0.45 0.015 45 1.5
#> 1995 to 2011 0.26 0.016 21 1.3
#Returns a data frame:
change <- tableChangeSingle(eList, fluxUnit = 8, yearPoints=c(1980, 1995, 2011), flux = FALSE)
#>
#> Choptank River
#> Inorganic nitrogen (nitrate and nitrite)
#> Water Year
#>
#> Concentration trends
#> time span change slope change slope
#> mg/L mg/L/yr % %/yr
#>
#> 1980 to 1995 0.2 0.013 20 1.3
#> 1980 to 2011 0.45 0.015 45 1.5
#> 1995 to 2011 0.26 0.016 21 1.3
#This returns flux values as a data frame:
df <- tableChangeSingle(eList, fluxUnit = 8, yearPoints=c(1980, 1995, 2011), flux = TRUE)
#>
#> Choptank River
#> Inorganic nitrogen (nitrate and nitrite)
#> Water Year
#>
#>
#>
#> Flux Trends
#> time span change slope change slope
#> 10^3 kg/yr 10^3 kg/yr/yr % %/yr
#>
#> 1980 to 1995 27 1.8 26 1.7
#> 1980 to 2011 42 1.4 39 1.3
#> 1995 to 2011 15 0.92 11 0.69
# Winter Concentration only:
eList <- setPA(eList, paStart = 12, paLong = 3)
df.winter <- tableChangeSingle(eList, fluxUnit = 8, yearPoints=c(1980, 1995, 2011), flux = FALSE)
#>
#> Choptank River
#> Inorganic nitrogen (nitrate and nitrite)
#> Season Consisting of Dec Jan Feb
#>
#> Concentration trends
#> time span change slope change slope
#> mg/L mg/L/yr % %/yr
#>
#> 1980 to 1995 0.2 0.013 18 1.2
#> 1980 to 2011 0.46 0.015 42 1.3
#> 1995 to 2011 0.26 0.016 20 1.3
# }