filterCoefData filters contributions of species to function by sign.

filterCoefData(coefData, type = "positive")

Arguments

coefData

Matrix of functions and coefficients for which species affect them from getRedundancy.

type

Are the kinds of effects we're looking at "positive", "negative" or "all".

Value

Returns a filtered matrix.

Details

Takes a matrix of functions and coefficients for species and filters out only the sign of contributions desired. Typically used by other functions in the package.

Author

Jarrett Byrnes.

Examples

data(all_biodepth)
allVars <- qw(biomassY3, root3, N.g.m2, light3, N.Soil, wood3, cotton3)

germany <- subset(all_biodepth, all_biodepth$location == "Germany")

vars <- whichVars(germany, allVars)
species <- relevantSp(germany, 26:ncol(germany))

# re-normalize N.Soil so that everything is on the same
# sign-scale (e.g. the maximum level of a function is
# the "best" function)
germany$N.Soil <- -1 * germany$N.Soil + max(germany$N.Soil, na.rm = TRUE)

res.list <- lapply(vars, function(x) sAICfun(x, species, germany))
names(res.list) <- vars

coefs <- getRedundancy(vars, species, germany, output = "coef")
stdCoefs <- stdEffects(coefs, germany, vars, species)

filterCoefData(stdCoefs)
#>             ACHMIL1   ALOPRA1  ANTODO1 ARRELA1   BROHOR1   CAMPAT1 CENJAC1
#> biomassY3 0.0000000 0.0000000 0.000000       0 0.0000000 0.0000000       0
#> root3     0.2545806 0.0000000 0.000000       0 0.5482183 0.0000000       0
#> N.g.m2    0.2083257 0.0000000 0.000000       0 0.0000000 0.0000000       0
#> N.Soil    0.0000000 0.0000000 0.000000       0 1.1112317 0.0000000       0
#> cotton3   0.0000000 0.2954783 1.061634       0 0.0000000 0.8870159       0
#>           CHRLEU1 CREBIE1 CYNCRI1   DACGLO1   FESPRA1   FESRUB1 GERPRA1 HOLLAN1
#> biomassY3       0 0.00000       0 0.1506547 0.1588554 0.0000000       0       0
#> root3           0 0.00000       0 0.0000000 0.0000000 0.3223808       0       0
#> N.g.m2          0 0.00000       0 0.0000000 0.2845360 0.0000000       0       0
#> N.Soil          0 1.71227       0 0.2846729 0.0000000 0.0000000       0       0
#> cotton3         0 0.00000       0 0.0000000 0.0000000 0.0000000       0       0
#>           KNAARV1   LATPRA1 LEOAUT1   LOLPER1   LOTCOR1 LYCFLO1   PHLPRA1
#> biomassY3       0 0.2342718       0 0.0000000 0.4398584       0 0.0000000
#> root3           0 0.3222751       0 0.3413014 0.0000000       0 0.0000000
#> N.g.m2          0 0.0000000       0 0.1201910 0.4888396       0 0.0000000
#> N.Soil          0 1.1149286       0 0.0000000 0.2943426       0 0.9196661
#> cotton3         0 0.0000000       0 0.0000000 0.0000000       0 0.0000000
#>           PIMMAJ1   PLALAN1 RANACR1 RUMACE1 TAROFF1   TRIPRA1   TRIREP1 VICCRA1
#> biomassY3       0 0.0000000 0.00000       0       0 0.6546163 0.4084509       0
#> root3           0 0.0000000 0.00000       0       0 0.0000000 0.0000000       0
#> N.g.m2          0 0.0000000 0.00000       0       0 0.8410219 0.4558752       0
#> N.Soil          0 0.0000000 0.59527       0       0 0.0000000 0.0000000       0
#> cotton3         0 0.4548995 0.00000       0       0 0.5531104 0.2790614       0
#>           VICSEP1
#> biomassY3       0
#> root3           0
#> N.g.m2          0
#> N.Soil          0
#> cotton3         0


#########
# filterCoefData takes a matrix of coefficients
# and filters it so that only the positive, negative, or both contributions
# are present
#########