Skip to content

Commit fb1a624

Browse files
committed
CRAN submission
1 parent 8182e09 commit fb1a624

7 files changed

+73
-18
lines changed

.Rbuildignore

+5
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
^_pkgdown\.yml$
44
^docs$
55
^pkgdown$
6+
7+
^README.Rmd
8+
^README_files
9+
10+
CONTRIBUTING

CONTRIBUTING

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# CONTRIBUTING #
2+
3+
### Please contribute!
4+
We love collaboration.
5+
6+
### Found a Bug?
7+
8+
* Submit an issue on our Issues page [here](https://github.com/andschar/standartox/issues).
9+
10+
### Code contributions?
11+
12+
* **Fork** this repo to your Github account.
13+
* **Clone** your version on your account down to your machine from your account, e.g,. `git clone https://github.com/<yourgithubusername>/standartox.git`.
14+
* Make sure to **track upstream** progress (i.e., on our version of `standartox` at `andschar/standartox`) by doing `git remote add upstream https://github.com/andschar/standartox.git`. Before making changes make sure to pull changes in from upstream by doing either `git fetch upstream` then merge later or `git pull upstream` to fetch and merge in one step
15+
* Make your **changes** (bonus points for making changes on a new branch).
16+
* **Push** up to your account.
17+
* Submit a **pull request** to home base at `andschar/standartox`.
18+
19+
### Code guidelines
20+
21+
We do not have strong guideline for our contributions and are happy to help.
22+
23+
1. Please follow [this](http://adv-r.had.co.nz/Style.html) styleguide for your contributions.
24+
25+
We want to keep dependencies to a minimum:
26+
27+
2. Please use the [`data.table`](https://github.com/Rdatatable/data.table) for data wrangling.
28+
29+
3. Please use the lightweight [`jsonlite`](https://github.com/jeroenooms/jsonlite) package for handling JSON.
30+
31+
4. Be nice to the resources! Use appropriate timeouts.
32+
33+
5. Tests go into a separate tests branch and not in the master branch.
34+
35+
### Questions?
36+
37+
Get in touch: [[email protected]](mailto:[email protected])
38+
39+
### Thanks for contributing!
40+

DESCRIPTION

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: standartox
2-
Version: 0.0.0.9024
3-
Date: 2020-09-05
4-
Title: Ecotoxicological information from the standartox database
2+
Version: 0.0.1
3+
Date: 2021-04-30
4+
Title: Ecotoxicological Information from the Standartox Database
55
Authors@R: c(
66
person("Andreas", "Scharmüller",
77
role = c("aut", "cre"),
@@ -16,6 +16,7 @@ Description: The <standartox.uni-landau.de> database offers cleaned,
1616
Depends:
1717
R (>= 3.5.0)
1818
Imports:
19+
stats,
1920
httr (>= 1.4.1),
2021
curl (>= 3.4),
2122
jsonlite (>= 1.6.1),

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
standartox 0.0.1
2+
=============================
3+
4+
initial release

R/standartox.R

+12-7
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ stx_catalog = function(vers = NULL) {
5959
#' \donttest{
6060
#' # might fail if API is not available
6161
#' stx_query('1071-83-6')
62-
#' stx_query(casnr = '1071-83-6',
62+
#' stx_query(cas = '1071-83-6',
6363
#' duration = c(48, 120),
6464
#' concentration_unit = 'ug/l')
65-
#' stx_query(casnr = '1071-83-6',
65+
#' stx_query(cas = '1071-83-6',
6666
#' duration = c(48, 120),
6767
#' concentration_unit = 'ug/l',
6868
#' endpoint = 'XX50')
6969
#' }
7070
#'
7171
#' @export
7272
#'
73-
stx_query = function(casnr = NULL,
73+
stx_query = function(cas = NULL,
7474
concentration_unit = NULL,
7575
concentration_type = NULL,
7676
duration = NULL,
@@ -86,13 +86,15 @@ stx_query = function(casnr = NULL,
8686
region = NULL,
8787
vers = NULL,
8888
...) {
89+
# to avoid NOTE in R CMD check --as-cran
90+
casnr = outlier = concentration = cname = NULL
8991
# debuging
9092
# browser() # debuging
91-
# casnr = '1071-83-6'; concentration_unit = NULL; concentration_type = NULL; duration = NULL; endpoint = 'XX50'; effect = NULL; exposure = NULL; chemical_role = NULL; chemical_class = NULL; taxa = NULL; ecotox_grp = NULL; trophic_lvl = NULL; habitat = NULL; region = NULL; vers = NULL
93+
# cas = '1071-83-6'; concentration_unit = NULL; concentration_type = NULL; duration = NULL; endpoint = 'XX50'; effect = NULL; exposure = NULL; chemical_role = NULL; chemical_class = NULL; taxa = NULL; ecotox_grp = NULL; trophic_lvl = NULL; habitat = NULL; region = NULL; vers = NULL
9294
# checks
9395
endpoint = match.arg(endpoint)
9496
# request
95-
body = list(casnr = casnr,
97+
body = list(casnr = cas,
9698
concentration_unit = concentration_unit,
9799
concentration_type = concentration_type,
98100
duration = duration,
@@ -237,11 +239,11 @@ stx_taxa = function() {
237239

238240
# IDEA
239241
# microbenchmark::microbenchmark({
240-
# col_test = c('result_id', 'casnr', 'species_number', 'ref_number',
242+
# col_test = c('result_id', 'cas', 'species_number', 'ref_number',
241243
# 'concentration', 'concentration_unit', 'concentration_orig', 'concentration_unit_orig',
242244
# 'concentration_type', 'duration', 'duration_unit',
243245
# 'endpoint', 'effect', 'exposure', 'outlier')
244-
# col_chem = c('cname', 'iupac_name', 'cas', 'casnr', 'inchikey', 'inchi',
246+
# col_chem = c('cname', 'iupac_name', 'cas', 'cas', 'inchikey', 'inchi',
245247
# 'molecularweight',
246248
# grep('cro|ccl', names(out_fil), value = TRUE))
247249
# col_taxa = c(
@@ -261,10 +263,13 @@ stx_taxa = function() {
261263

262264
#' Function to aggregate filtered test results
263265
#'
266+
#'
264267
#' @author Andreas Scharmueller \email{andschar@@protonmail.com}
265268
#' @noRd
266269
#'
267270
stx_aggregate = function(dat = NULL) {
271+
# assign variables to avoid R CMD check NOTES
272+
. = concentration = cname = cas = tax_taxon = gmn = gmnsd = n = NULL
268273
# checking
269274
if (is.null(dat)) stop('Provide table.')
270275
# aggregation

R/utils.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ gm_sd = function (x, na.rm = TRUE, sqrt.unbiased = TRUE) {
105105
warning("Non-positive values in 'x'")
106106
return(NA_real_)
107107
} else {
108-
sd.log = sd(log(x))
108+
sd.log = stats::sd(log(x))
109109
if (!sqrt.unbiased) {
110110
n = length(x)
111111
sd.log = sqrt((n - 1)/n) * sd.log
@@ -120,8 +120,8 @@ gm_sd = function (x, na.rm = TRUE, sqrt.unbiased = TRUE) {
120120
#' @noRd
121121
#'
122122
flag_outliers = function(x, lim = 1.5, na.rm = TRUE, ...) {
123-
qnt = quantile(x, probs = c(.25, .75), na.rm = na.rm)
124-
H = lim * IQR(x, na.rm = na.rm)
123+
qnt = stats::quantile(x, probs = c(.25, .75), na.rm = na.rm)
124+
H = lim * stats::IQR(x, na.rm = na.rm)
125125
fifelse(x < qnt[1] - H | x > qnt[2] + H, TRUE, FALSE)
126126
}
127127

man/stx_query.Rd

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)