Working as a data scientist in the environmental field with Tetra Tech (since 1994).
Working in R since 2006 and Shiny since 2017. Using GitHub for version control since 2016.
Extirpation analysis (XC95) for benthic macroinvertebrates and fish for environmental variables.
Home Page: https://leppott.github.io/XC95/
Several issues.
Not generic enough. Some variables still hard coded into the function (e.g., always wants 3 groups and they are HUC, EcoRegion, and WS Area).
Function name should lose the "fish" name. Will keep fish.wt.cdf but will hide it.
Includes a subdirectory.
Not every parameter should be defaulted. The data files especially.
The option to add a map in the tolerance function only works if the maps library is in the global environment.
Update the function to use maps::map
Add the maps library to the DESCRIPTION file.
Add a boot strap function/routine.
Not in current functions.
nb
The function auc() (area under curve) appears in multiple functions. Should pull out into its own function.
nb
Need to define, in the help file, the fields in the output.
names(cont.opt)
[1] "tnames" "N" "min_ob" "X50_th_ob" "X95_th_ob"
[6] "max_ob" "Opt_WA" "Tol_WA" "CDF_50_th_Abund" "CDF_95_th_Abund"
[11] "CDF_50_th_PA" "CDF_95_th_PA" "CDF_wt_50_th" "CDF_wt_95_th" "LRM_50_th"
[16] "LRM_95_th" "QLRM_50_th" "QLRM_95_th" "Opt_qlrm" "Tol_qlrm"
[21] "GAM_50_th" "GAM_95_th" "ROC"
Is your feature request related to a problem? Please describe.
Not a separate function. Basic calculation.
The HC05 is the 5th percentile hazardous concentration of a set of related 95th percentile extirpation concentration values (XC95). The HC05 is the estimated value of the stressor at which 5% of species will be extirpated.
Describe the solution you'd like
Pulled from BC paper code, March 2017 and some other files from June 2016.
Describe alternatives you've considered
Add as an example
Additional context
Run example for fish.wt.cdf to get XC95 values.
# data
data(dta.do)
data(ss.sites)
# run function (~20 seconds)
dftv.do <- fish.wt.cdf(datafile = dta.do, ss = ss.sites, plot = T, dogam = T
, SampleID = "Station_Date", tag = "wt", sortvect = NULL
, np = 61, nt = 25, addtrend = T
, wd = getwd(), groups = c("BigHUC","ECOREGL3","WS_AREA")
, xvar = "cond")
View(dftv.do)
knitr::kable(head(dftv.do))
GENUS | XC95.cdf | trend | XC95.gam | total.n | total.N | HUC | eco3 | wtshed | |
---|---|---|---|---|---|---|---|---|---|
26 | Etheostoma baileyi | 322 | = | 501 | 38 | 1729 | 500 | 70_69_68 | 1.8_353 |
78 | Noturus insignis | 351 | = | 347 | 208 | 3259 | 204_205_207_208_301_500_601 | 67_69 | 19.597_8336.5394 |
22 | Erimyzon oblongus | 382 | = | 443 | 26 | 3232 | 204_205_207_208_500 | 70_67_69 | 4.3934_493.1524 |
25 | Esox niger | 467 | ~ | 672 | 63 | 1503 | 204_205_207_208 | 67_69 | 3.4644_742.9773 |
98 | Salvelinus fontinalis | 508 | = | 639 | 1361 | 3215 | 204_205_207_500 | 67_69_70 | 1.4111_395.4895 |
16 | Cottus girardi | 518 | ~ | 672 | 31 | 1085 | 205_207 | 67 | 2.0236_594.457 |
Then calculate the 5th quantile.
hc05_cdf <- quantile(dftv.do$XC95.cdf, probs = 0.05, na.rm = TRUE, type = 6)
hc05_gam <- quantile(dftv.do$XC95.gam, probs = 0.05, na.rm = TRUE, type = 6)
# both at once
hc05_both <- apply(dftv.do[, c("XC95.cdf", "XC95.gam")], 2
, quantile, probs=0.05, na.rm=TRUE, type=6)
Describe the bug
Tibbles sometimes behave different from data frames.
For example, if use read_csv rather than read.csv the user creates a tibble. The way tibbles react when subsetted can throw off expected data formats inside of the functions.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Can fix (and have in other packages) by adding a line to convert any input that might be a tibble to a dataframe.
df.x <- as.data.frame(input.df.x)
nb
Need to post to CRAN.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.