filterOverData
filters qualitative effects of species
to function by sign.
filterOverData(overData, type = "positive")
Matrix of functions and which species affect them from getRedundancy
.
Are the kinds of effects we're looking at "positive", "negative" or "all".
Returns a filtered matrix.
Takes a matrix of functions and effects of species - 1's and -1's, s - and filters out only the sign of contributions desired. Typically used by other functions in the package.
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
redund <- getRedundancy(vars, species, germany)
filterOverData(redund, type = "positive")
#> ACHMIL1 ALOPRA1 ANTODO1 ARRELA1 BROHOR1 CAMPAT1 CENJAC1 CHRLEU1
#> biomassY3 0 0 0 0 0 0 0 0
#> root3 1 0 0 0 1 0 0 0
#> N.g.m2 1 0 0 0 0 0 0 0
#> N.Soil 0 0 0 0 1 0 0 0
#> cotton3 0 1 1 0 0 1 0 0
#> CREBIE1 CYNCRI1 DACGLO1 FESPRA1 FESRUB1 GERPRA1 HOLLAN1 KNAARV1
#> biomassY3 0 0 1 1 0 0 0 0
#> root3 0 0 0 0 1 0 0 0
#> N.g.m2 0 0 0 1 0 0 0 0
#> N.Soil 1 0 1 0 0 0 0 0
#> cotton3 0 0 0 0 0 0 0 0
#> LATPRA1 LEOAUT1 LOLPER1 LOTCOR1 LYCFLO1 PHLPRA1 PIMMAJ1 PLALAN1
#> biomassY3 1 0 0 1 0 0 0 0
#> root3 1 0 1 0 0 0 0 0
#> N.g.m2 0 0 1 1 0 0 0 0
#> N.Soil 1 0 0 1 0 1 0 0
#> cotton3 0 0 0 0 0 0 0 1
#> RANACR1 RUMACE1 TAROFF1 TRIPRA1 TRIREP1 VICCRA1 VICSEP1
#> biomassY3 0 0 0 1 1 0 0
#> root3 0 0 0 0 0 0 0
#> N.g.m2 0 0 0 1 1 0 0
#> N.Soil 1 0 0 0 0 0 0
#> cotton3 0 0 0 1 1 0 0
#########
# filterOverData takes a matrix of 1s, 0s, and -1s
# and filters it so that only the positive, negative, or both contributions
# are 1 for later overlap function usage
#########