Skip to content

Commit 9dd43a2

Browse files
Merge pull request #24 from pepijn-devries/work-in-progress
Work in progress
2 parents 4d1f175 + 5949c49 commit 9dd43a2

File tree

11 files changed

+133
-98
lines changed

11 files changed

+133
-98
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.Rproj.user
2+
.Rhistory
3+
.RData
4+
.Ruserdata

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: ECOTOXr
22
Type: Package
33
Title: Download and Extract Data from US EPA's ECOTOX Database
4-
Version: 1.0.2
5-
Date: 2023-06-18
4+
Version: 1.0.3
5+
Date: 2023-08-21
66
Authors@R: c(person("Pepijn", "de Vries", role = c("aut", "cre", "dtc"),
77
email = "[email protected]",
88
comment = c(ORCID = "0000-0002-7961-6646")))
@@ -41,11 +41,11 @@ Suggests:
4141
standartox,
4242
testthat (>= 3.0.0),
4343
webchem
44-
URL: <https://github.com/pepijn-devries/ECOTOXr>
44+
URL: https://github.com/pepijn-devries/ECOTOXr
4545
BugReports: https://github.com/pepijn-devries/ECOTOXr/issues
4646
License: GPL (>= 3)
4747
Encoding: UTF-8
4848
LazyData: true
49-
RoxygenNote: 7.1.2
49+
RoxygenNote: 7.2.3
5050
Config/testthat/edition: 3
5151
Roxygen: list(markdown = TRUE)

ECOTOXr.Rproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: Default
4+
SaveWorkspace: Default
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 2
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX
14+
15+
BuildType: Package
16+
PackageUseDevtools: Yes
17+
PackageInstallArgs: --no-multiarch --with-keep.source
18+
PackageRoxygenize: rd,collate,namespace
Lines changed: 73 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,73 @@
1-
#' Package description
2-
#'
3-
#' Everything you need to know when you start using the ECOTOXr package. \if{html}{\figure{logo.png}}
4-
#'
5-
#' The ECOTOXr provides the means to efficiently search, extract and analyse [US EPA](https://www.epa.gov/)
6-
#' [ECOTOX](https://cfpub.epa.gov/ecotox/) data, with a focus on reproducible results. Although the package
7-
#' creator/maintainer is confident in the quality of this software, it is the end users sole responsibility to
8-
#' assure the quality of his or her work while using this software. As per the provided license terms the package
9-
#' maintainer is not liable for any damage resulting from its usage. That being said, below we present some tips
10-
#' for generating reproducible results with this package.
11-
#'
12-
#' @section How do I get started?:
13-
#' Installing this package is only the first step to get things started. You need to perform the following steps
14-
#' in order to use the package to its full capacity.
15-
#'
16-
#' * First download a copy of the complete EPA database. This can be done by calling [download_ecotox_data()].
17-
#' This may not always work on all machines as R does not always accept the website SSL certificate from the EPA.
18-
#' In those cases the zipped archive with the database files can be downloaded manually with a different (more
19-
#' forgiving) browser. The files from the zip archive can be extracted to a location of choice. Alternatively,
20-
#' the user could try to use `[download_ecotox_data](ssl_verifypeer = 0L)` when the download URL is trusted.
21-
#' * Next, an SQLite database needs to be build from the downloaded files. This will be done automatically when
22-
#' you used [download_ecotox_data()] in the previous step. When you have manually downloaded the files
23-
#' you can call [build_ecotox_sqlite()] to build the database locally.
24-
#' * When the previous steps have been performed successfully, you can now search the database by calling
25-
#' [search_ecotox()]. You can also use [dbConnectEcotox()] to open a connection to the
26-
#' database. You can query the database using this connection and any of the methods provided from the
27-
#' [DBI][DBI::DBI] or [RSQLite][RSQLite::RSQLite] packages.
28-
#'
29-
#' @section How do I obtain reproducible results?:
30-
#' Each individual user is responsible for evaluating the reproducibility of his or her work. Although
31-
#' this package offers instruments to achieve reproducibility, it is not guaranteed. In order to increase the
32-
#' chances of generating reproducible results, one should adhere at least to the following rules:
33-
#' * Always use an official release from CRAN, and cite the version used in your analyses (`citation("ECOTOXr")`).
34-
#' Different versions, may produce different end results (although we will strive for backward compatibility).
35-
#' * Make sure you are working with a clean (unaltered) version of the database. When in doubt, download and build
36-
#' a fresh copy of the database ([download_ecotox_data()]). Also cite the (release) version of the downloaded
37-
#' database ([cite_ecotox()]), and the system operating system in which the local database was build
38-
#' [get_ecotox_info()]). Or, just make sure that you never modify the database (e.g., write data to it, delete
39-
#' data from it, etc.)
40-
#' * In order to avoid platform dependencies it is advised to only include non-accented alpha-numerical characters in
41-
#' search terms. See also [search_ecotox] and [build_ecotox_sqlite].
42-
#' * When trying to reproduce database extractions from earlier database releases, filter out additions after
43-
#' that specific release. This can be done by adding output fields 'tests.modified_date', 'tests.created_date' and
44-
#' 'tests.published_date' to your search and compare those with the release date of the database you are trying to
45-
#' reproduce results from.
46-
#'
47-
#' @section Why isn't the database included in the package?:
48-
#' This package doesn't come bundled with a copy of the database which needs to be downloaded the first time the
49-
#' package is used. Why is this? There are several reasons:
50-
#' * The database is maintained and updated by the [US EPA](https://www.epa.gov/). This process is and should be
51-
#' outside the sphere of influence of the package maintainer.
52-
#' * Packages on CRAN are not allowed to contain large amounts of data. Publication on CRAN is key to control
53-
#' the quality of this package and therefore outweighs the convenience of having the data bundled with the package.
54-
#' * The user has full control over the release version of the database that is being used.
55-
#'
56-
#' @section Why does this package promotes using a local copy of the ECOTOX database?:
57-
#' Although this package offers experimental features for searching on-line, there are several reasons why we
58-
#' opted for creating a local copy:
59-
#' * The user would be restricted to the search options provided on the website ([ECOTOX](https://cfpub.epa.gov/ecotox/)).
60-
#' * The on-line database doesn't come with an API that would allow for convenient interface. This is why
61-
#' features implemented in this package are experimental.
62-
#' * The user is not limited by an internet connection and its bandwidth.
63-
#' * Not all database fields, and only a limited number of records, can be retrieved from the on-line interface.
64-
#' @docType package
65-
#' @name ECOTOXr
66-
#' @author Pepijn de Vries
67-
#' @references
68-
#' Official US EPA ECOTOX website:
69-
#' <https://cfpub.epa.gov/ecotox/>
70-
#'
71-
#' Olker, J.H., Elonen, C.M., Pilli, A., Anderson, A., Kinziger, B., Erickson, S., Skopinski, M., Pomplun, A., LaLone, C.A.,
72-
#' Russom, C.L. and Hoff, D. (2022), The ECOTOXicology Knowledgebase: A Curated Database of Ecologically Relevant Toxicity
73-
#' Tests to Support Environmental Research and Risk Assessment. _Environ Toxicol Chem_, 41: 1520-1539.
74-
NULL
1+
#' Package description
2+
#'
3+
#' Everything you need to know when you start using the ECOTOXr package. \if{html}{\figure{logo.png}}
4+
#'
5+
#' The ECOTOXr provides the means to efficiently search, extract and analyse [US EPA](https://www.epa.gov/)
6+
#' [ECOTOX](https://cfpub.epa.gov/ecotox/) data, with a focus on reproducible results. Although the package
7+
#' creator/maintainer is confident in the quality of this software, it is the end users sole responsibility to
8+
#' assure the quality of his or her work while using this software. As per the provided license terms the package
9+
#' maintainer is not liable for any damage resulting from its usage. That being said, below we present some tips
10+
#' for generating reproducible results with this package.
11+
#'
12+
#' @section How do I get started?:
13+
#' Installing this package is only the first step to get things started. You need to perform the following steps
14+
#' in order to use the package to its full capacity.
15+
#'
16+
#' * First download a copy of the complete EPA database. This can be done by calling [download_ecotox_data()].
17+
#' This may not always work on all machines as R does not always accept the website SSL certificate from the EPA.
18+
#' In those cases the zipped archive with the database files can be downloaded manually with a different (more
19+
#' forgiving) browser. The files from the zip archive can be extracted to a location of choice. Alternatively,
20+
#' the user could try to use `[download_ecotox_data](ssl_verifypeer = 0L)` when the download URL is trusted.
21+
#' * Next, an SQLite database needs to be build from the downloaded files. This will be done automatically when
22+
#' you used [download_ecotox_data()] in the previous step. When you have manually downloaded the files
23+
#' you can call [build_ecotox_sqlite()] to build the database locally.
24+
#' * When the previous steps have been performed successfully, you can now search the database by calling
25+
#' [search_ecotox()]. You can also use [dbConnectEcotox()] to open a connection to the
26+
#' database. You can query the database using this connection and any of the methods provided from the
27+
#' [DBI][DBI::DBI] or [RSQLite][RSQLite::RSQLite] packages.
28+
#'
29+
#' @section How do I obtain reproducible results?:
30+
#' Each individual user is responsible for evaluating the reproducibility of his or her work. Although
31+
#' this package offers instruments to achieve reproducibility, it is not guaranteed. In order to increase the
32+
#' chances of generating reproducible results, one should adhere at least to the following rules:
33+
#' * Always use an official release from CRAN, and cite the version used in your analyses (`citation("ECOTOXr")`).
34+
#' Different versions, may produce different end results (although we will strive for backward compatibility).
35+
#' * Make sure you are working with a clean (unaltered) version of the database. When in doubt, download and build
36+
#' a fresh copy of the database ([download_ecotox_data()]). Also cite the (release) version of the downloaded
37+
#' database ([cite_ecotox()]), and the system operating system in which the local database was build
38+
#' [get_ecotox_info()]). Or, just make sure that you never modify the database (e.g., write data to it, delete
39+
#' data from it, etc.)
40+
#' * In order to avoid platform dependencies it is advised to only include non-accented alpha-numerical characters in
41+
#' search terms. See also [search_ecotox] and [build_ecotox_sqlite].
42+
#' * When trying to reproduce database extractions from earlier database releases, filter out additions after
43+
#' that specific release. This can be done by adding output fields 'tests.modified_date', 'tests.created_date' and
44+
#' 'tests.published_date' to your search and compare those with the release date of the database you are trying to
45+
#' reproduce results from.
46+
#'
47+
#' @section Why isn't the database included in the package?:
48+
#' This package doesn't come bundled with a copy of the database which needs to be downloaded the first time the
49+
#' package is used. Why is this? There are several reasons:
50+
#' * The database is maintained and updated by the [US EPA](https://www.epa.gov/). This process is and should be
51+
#' outside the sphere of influence of the package maintainer.
52+
#' * Packages on CRAN are not allowed to contain large amounts of data. Publication on CRAN is key to control
53+
#' the quality of this package and therefore outweighs the convenience of having the data bundled with the package.
54+
#' * The user has full control over the release version of the database that is being used.
55+
#'
56+
#' @section Why does this package promotes using a local copy of the ECOTOX database?:
57+
#' Although this package offers experimental features for searching on-line, there are several reasons why we
58+
#' opted for creating a local copy:
59+
#' * The user would be restricted to the search options provided on the website ([ECOTOX](https://cfpub.epa.gov/ecotox/)).
60+
#' * The on-line database doesn't come with an API that would allow for convenient interface. This is why
61+
#' features implemented in this package are experimental.
62+
#' * The user is not limited by an internet connection and its bandwidth.
63+
#' * Not all database fields, and only a limited number of records, can be retrieved from the on-line interface.
64+
#' @references
65+
#' Official US EPA ECOTOX website:
66+
#' <https://cfpub.epa.gov/ecotox/>
67+
#'
68+
#' Olker, J.H., Elonen, C.M., Pilli, A., Anderson, A., Kinziger, B., Erickson, S., Skopinski, M., Pomplun, A., LaLone, C.A.,
69+
#' Russom, C.L. and Hoff, D. (2022), The ECOTOXicology Knowledgebase: A Curated Database of Ecologically Relevant Toxicity
70+
#' Tests to Support Environmental Research and Risk Assessment. _Environ Toxicol Chem_, 41: 1520-1539.
71+
#' @keywords internal
72+
"_PACKAGE"
73+
NULL

R/cas_handlers.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#' @param hyphenate A `logical` value indicating whether the formatted CAS number needs to be hyphenated.
2020
#' Default is `TRUE`.
2121
#' @param ... Arguments passed to other functions
22-
#' @return Functions `cas`, `c` and `as.cas` return S3 class 'cas' objects. Coercion functions
22+
#' @returns Functions `cas`, `c` and `as.cas` return S3 class 'cas' objects. Coercion functions
2323
#' (starting with 'as') return the object as specified by their respective function names (i.e., `integer`,
2424
#' `double`, `character`, `list` and `data.frame`). The `show.cas` and `print` functions
2525
#' also return formatted `charater`s. The function `is.cas` will return a single `logical` value,

R/database_access.r

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ get_ecotox_sqlite_file <- function(path = get_ecotox_path(), version) {
3535
#' @param conn An open connection to the ECOTOX database that needs to be closed.
3636
#' @param ... Arguments that are passed to [`dbConnect()`][RSQLite::SQLite] method
3737
#' or [`dbDisconnect()`][RSQLite::SQLite] method.
38-
#' @return A database connection in the form of a [DBI::DBIConnection-class()] object.
38+
#' @returns A database connection in the form of a [DBI::DBIConnection-class()] object.
3939
#' The object is tagged with: a time stamp; the package version used; and the
4040
#' file path of the SQLite database used in the connection. These tags are added as attributes
4141
#' to the object.
@@ -80,7 +80,7 @@ dbDisconnectEcotox <- function(conn, ...) {
8080
#' @param version A `character` string referring to the release version of the database you wish to locate.
8181
#' It should have the same format as the date in the EPA download link, which is month, day, year, separated by
8282
#' underscores ("%m_%d_%Y"). When missing, the most recent available copy is selected automatically.
83-
#' @return Returns a `vector` of [bibentry()]'s, containing a reference to the downloaded database
83+
#' @returns Returns a `vector` of [bibentry()]'s, containing a reference to the downloaded database
8484
#' and this package.
8585
#' @rdname cite_ecotox
8686
#' @name cite_ecotox
@@ -111,7 +111,7 @@ cite_ecotox <- function(path = get_ecotox_path(), version) {
111111
#' @param version A `character` string referring to the release version of the database you wish to locate.
112112
#' It should have the same format as the date in the EPA download link, which is month, day, year, separated by
113113
#' underscores ("%m_%d_%Y"). When missing, the most recent available copy is selected automatically.
114-
#' @return Returns a `vector` of `character`s, containing a information on the selected local ECOTOX database.
114+
#' @returns Returns a `vector` of `character`s, containing a information on the selected local ECOTOX database.
115115
#' @rdname get_ecotox_info
116116
#' @name get_ecotox_info
117117
#' @examples
@@ -154,7 +154,7 @@ get_ecotox_info <- function(path = get_ecotox_path(), version) {
154154
#' 'dose_response_details', 'dose_response_links' and 'dose_stat_method_codes'.
155155
#' @param include_table A `logical` value indicating whether the table name should be included
156156
#' as prefix. Default is `TRUE`.
157-
#' @return Returns a `vector` of type `character` containing the field names from the ECOTOX database.
157+
#' @returns Returns a `vector` of type `character` containing the field names from the ECOTOX database.
158158
#' @rdname list_ecotox_fields
159159
#' @name list_ecotox_fields
160160
#' @examples

R/init.r

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' by using this URL in a different browser (or on a different machine). Alternatively, the user could try to use
99
#' `[download_ecotox_data](ssl_verifypeer = 0L)` when the download URL is trusted.
1010
#' @param ... arguments passed on to [httr::GET()]
11-
#' @return Returns a `character` string containing the download URL of the latest version of the EPA ECOTOX
11+
#' @returns Returns a `character` string containing the download URL of the latest version of the EPA ECOTOX
1212
#' database.
1313
#' @rdname get_ecotox_url
1414
#' @name get_ecotox_url
@@ -36,7 +36,7 @@ get_ecotox_url <- function(...) {
3636
#' When arguments are omitted, this function will look in the default directory ([get_ecotox_path()]).
3737
#' However, it is possible to build a database file elsewhere if necessary.
3838
#' @param target A `character` string specifying the path where to look for the database file.
39-
#' @return Returns a `logical` value indicating whether a copy of the database exists. It also returns
39+
#' @returns Returns a `logical` value indicating whether a copy of the database exists. It also returns
4040
#' a `files` attribute that lists which copies of the database are found.
4141
#' @rdname check_ecotox_availability
4242
#' @name check_ecotox_availability
@@ -79,7 +79,7 @@ check_ecotox_availability <- function(target = get_ecotox_path()) {
7979
#' @param version A `character` string referring to the release version of the database you wish to locate.
8080
#' It should have the same format as the date in the EPA download link, which is month, day, year, separated by
8181
#' underscores ("%m_%d_%Y"). When missing, the most recent available copy is selected automatically.
82-
#' @return Returns a `character` string of the path.
82+
#' @returns Returns a `character` string of the path.
8383
#' `get_ecotox_path` will return the default directory of the database.
8484
#' `get_ecotox_sqlite_file` will return the path to the sqlite file when it exists.
8585
#' @rdname get_path
@@ -128,7 +128,7 @@ get_ecotox_path <- function() {
128128
#' @param ... Arguments passed on to [httr::GET()]. When this function fails with the error: "Peer
129129
#' certificate cannot be authenticated with given CA certificates", you could try to rerun the function with
130130
#' the option `ssl_verifypeer = 0L`. Only do so when you trust the indicated URL.
131-
#' @return Returns `NULL` invisibly.
131+
#' @returns Returns `NULL` invisibly.
132132
#' @rdname download_ecotox_data
133133
#' @name download_ecotox_data
134134
#' @examples
@@ -251,7 +251,7 @@ download_ecotox_data <- function(target = get_ecotox_path(), write_log = TRUE, a
251251
# after building the SQLite database. See \code{\link{build_ecotox_sqlite}()} for more details. Default is
252252
#' `TRUE`. The log contains information on the source and destination path, the version of this package,
253253
#' the creation date, and the operating system on which the database was created.
254-
#' @return Returns `NULL` invisibly.
254+
#' @returns Returns `NULL` invisibly.
255255
#' @rdname build_ecotox_sqlite
256256
#' @name build_ecotox_sqlite
257257
#' @examples
@@ -438,7 +438,7 @@ build_ecotox_sqlite <- function(source, destination = get_ecotox_path(), write_l
438438
paste(unexpected_fields, collapse = ", "),
439439
paste(incomplete_check, collapse = ", ")
440440
),
441-
con = logfile, )
441+
con = logfile)
442442
}
443443
return(invisible(NULL))
444444
}

0 commit comments

Comments
 (0)