Skip to content

Commit f75eef6

Browse files
authored
Merge pull request #47 from thiloshon/master
Cran fixes. Check cran-comments
2 parents 8c2a5d0 + cb648b3 commit f75eef6

17 files changed

Lines changed: 118 additions & 91 deletions

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
^cran-comments\.md$
2+
^CRAN-RELEASE$
13
^.*\.Rproj$
24
^\.Rproj\.user$
35
^\.travis\.yml$

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
2+
13
language: R
2-
cache: packages
3-
warnings_are_errors: false
4-
r_packages: - covr
5-
after_success: - Rscript -e 'covr::codecov()'
4+
sudo: false
5+
cache: packages

DESCRIPTION

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Package: bdclean
22
Type: Package
3-
Title: A user-friendly data cleaning app for the inexperienced R user.
4-
Description: bdclean provides features to manage complete workflow for biodiversity data cleaning, from uploading the data; gathering input from the user, in order to adjust cleaning procedures; perform the cleaning; and finally, generating various reports and several versions of the data. 'bdclean' facilitates user-level data cleaning, designed for the inexperienced R user.
5-
Version: 0.1.100
6-
Date: 2019-02-26
3+
Title: A User-Friendly Biodiversity Data Cleaning App for the Inexperienced R User
4+
Description: Provides features to manage complete work flow for biodiversity data cleaning, from uploading the data; gathering input from the user, in order to adjust cleaning procedures; perform the cleaning; and finally, generating various reports and several versions of the data. Facilitates user-level data cleaning, designed for the inexperienced R user. T Gueta et al (2018) <doi:10.3897/biss.2.25564>. T Gueta et al (2017) <doi:10.3897/tdwgproceedings.1.20311>.
5+
Version: 0.1.12
6+
Date: 2019-03-02
77
License: GPL-3
8-
URL: https://github.com/bd-R/bdclean
8+
URL: https://github.com/bd-R/bdclean, https://bd-r.github.io/The-bdverse/index.html
99
BugReports: https://github.com/bd-R/bdclean/issues
1010
Authors@R: c(
1111
person(
@@ -38,9 +38,9 @@ Authors@R: c(
3838
comment = c(ORCID = '0000-0002-5883-0184'))
3939
)
4040
Maintainer: Thiloshon Nagarajah <thiloshon@gmail.com>
41-
Imports: rmarkdown, knitr, shiny, shinydashboard, shinyjs, leaflet, DT, data.table, rgbif, spocc, finch, bdDwC, bdchecks
41+
Imports: rmarkdown, knitr, shiny, shinydashboard, shinyjs, leaflet, DT, data.table, rgbif, spocc, finch, bdDwC, bdchecks, methods, tools
4242
Depends: R (>= 2.10)
43-
RoxygenNote: 6.0.1
43+
RoxygenNote: 6.1.1
4444
Suggests:
4545
testthat
4646
LazyData: true

NAMESPACE

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ export(run_questionnaire)
1313
export(spatialResolution)
1414
export(taxoLevel)
1515
export(temporalResolution)
16-
import(DT)
1716
import(bdDwC)
1817
import(bdchecks)
1918
import(data.table)
2019
import(finch)
2120
import(leaflet)
2221
import(rgbif)
23-
import(shiny)
2422
import(shinydashboard)
2523
import(shinyjs)
2624
import(spocc)
25+
import(tools)
26+
importFrom(methods,new)
27+
importFrom(shiny,runApp)
2728
importFrom(tools,Rd_db)

R/clean_data.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ run_questionnaire <- function(customQuestionnaire = NULL) {
139139
}
140140

141141
#' Internal function for getting user response
142+
#'
143+
#'@param bdQuestion The BDQuestion object to get users responses.
144+
#'
142145
getUserResponse <- function(bdQuestion) {
143146
# Child & ChildRouter already filtered in first loop above
144147

R/data.R

Lines changed: 0 additions & 7 deletions
This file was deleted.

R/decision_making.R

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ cleaning_function <- function(bddata) {
4141
#'
4242
#' NOTE: This is an package internal function. Do not use for external uses.
4343
#'
44+
#'@param flaggedData The dataset with flags to be cleaned.
45+
#'@param cleaningThreshold The Cleaning tolerance. Not used in current version.
46+
#'
4447
perform_Cleaning <- function(flaggedData, cleaningThreshold = 5) {
4548
flagColumns <- which(grepl("bdclean", names(flaggedData)))
4649

@@ -89,31 +92,44 @@ get_checks_list <- function() {
8992
gsub(".Rd", "", names(packageDocumentation)[i])
9093

9194
functionDocumentation <- packageDocumentation[i]
92-
description <-
93-
lapply(functionDocumentation,
94-
tools:::.Rd_get_metadata,
95-
"description")[[1]]
9695

97-
sectionsString <-
98-
as.character(lapply(
99-
functionDocumentation,
100-
tools:::.Rd_get_metadata,
101-
"section"
102-
)[[1]])
96+
brokenDocumentation <-
97+
unlist(strsplit(
98+
paste(functionDocumentation[[1]], collapse = " "),
99+
split = '\\',
100+
fixed = TRUE
101+
))
102+
103+
brokenDocumentation <- gsub("\\n", "",
104+
gsub(
105+
"[{}]", "", brokenDocumentation
106+
)
107+
)
103108

104-
sectionsVector <-
105-
gsub(", ,", "", gsub("\\\\n", "", gsub(
106-
"[()\"]", "", substr(sectionsString, 5, nchar(sectionsString))
107-
)))
109+
description <-
110+
brokenDocumentation[grep("title", brokenDocumentation)]
111+
description <-
112+
gsub("title Data check", "", description, fixed = T)
108113

109114
samplePassData <-
110-
sectionsVector[match('samplePassData', sectionsVector) + 1]
115+
brokenDocumentation[grep("samplePassData", brokenDocumentation)]
116+
samplePassData <-
117+
gsub("section samplePassData", "", samplePassData, fixed = T)
118+
119+
sampleFailData <-
120+
brokenDocumentation[grep("sampleFailData", brokenDocumentation)]
111121
sampleFailData <-
112-
sectionsVector[match('sampleFailData', sectionsVector) + 1]
122+
gsub("section sampleFailData", "", sampleFailData, fixed = T)
123+
113124
checkCategory <-
114-
gsub(" ", "", sectionsVector[match('checkCategory', sectionsVector) + 1])
125+
brokenDocumentation[grep("checkCategory", brokenDocumentation)]
126+
checkCategory <-
127+
gsub("section checkCategory", "", checkCategory, fixed = T)
128+
129+
targetDWCField <-
130+
brokenDocumentation[grep("targetDWCField", brokenDocumentation)]
115131
targetDWCField <-
116-
sectionsVector[match('targetDWCField', sectionsVector) + 1]
132+
gsub("section targetDWCField", "", targetDWCField, fixed = T)
117133

118134
temp <- list()
119135

R/reference_classes.R

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#'
33
#' @export BdQuestion
44
#' @importFrom tools Rd_db
5+
#' @importFrom methods new
56
BdQuestion <-
67
setRefClass(
78
"BdQuestion",
@@ -116,6 +117,7 @@ BdQuestion <-
116117
bdchecks::performDataCheck(data = flaggedData,
117118
DConly = c(checkName))
118119

120+
119121
if (!is.null(checkTemp) &&
120122
length(checkTemp@flags) > 0 &&
121123
length(checkTemp@flags[[1]]@result) > 0) {
@@ -147,14 +149,14 @@ BdQuestion <-
147149
addToReport = function(flaggedData,
148150
clean = TRUE,
149151
CleaningThreshold = 5) {
150-
packageDocumentation <- tools::Rd_db("bdclean")
152+
packageDocumentation <- tools::Rd_db("bdchecks")
151153
flaggedData <- as.data.frame(flaggedData)
152154

153-
154155
for (i in 1:length(.self$quality.checks)) {
155156
nameOfQualityCheck <- .self$quality.checks[i]
156157

157-
if (!(paste("bdclean", nameOfQualityCheck, sep = ".") %in% names(flaggedData))) {
158+
if (!(paste("bdclean", nameOfQualityCheck, sep = ".") %in% names(flaggedData))) {
159+
# both bdchecks and bdclean columns have bdcelan prefix
158160
warning(
159161
"Required column ",
160162
paste("bdclean", nameOfQualityCheck, sep = "."),
@@ -165,7 +167,7 @@ BdQuestion <-
165167
}
166168

167169
flag <-
168-
flaggedData[paste("bdclean", nameOfQualityCheck, sep = ".")]
170+
flaggedData[,paste("bdclean", nameOfQualityCheck, sep = ".")]
169171

170172
# Uncomment if using threshold
171173
# countOfFlaggedData <-
@@ -179,13 +181,6 @@ BdQuestion <-
179181
functionDocumentation <-
180182
packageDocumentation[grep(nameOfQualityCheck, names(packageDocumentation))]
181183

182-
# Delete this
183-
if (length(functionDocumentation) == 0) {
184-
functionDocumentation <-
185-
packageDocumentation[grep("taxoLevel", names(packageDocumentation))]
186-
}
187-
188-
189184
if (length(functionDocumentation) == 0) {
190185
warning(
191186
"Could not find function documentation for ",
@@ -195,31 +190,45 @@ BdQuestion <-
195190
next
196191
}
197192

198-
description <-
199-
lapply(functionDocumentation,
200-
tools:::.Rd_get_metadata,
201-
"description")[[1]]
202193

203-
sectionsString <-
204-
as.character(lapply(
205-
functionDocumentation,
206-
tools:::.Rd_get_metadata,
207-
"section"
208-
)[[1]])
194+
brokenDocumentation <-
195+
unlist(strsplit(
196+
paste(functionDocumentation[[1]], collapse = " "),
197+
split = '\\',
198+
fixed = TRUE
199+
))
209200

210-
sectionsVector <-
211-
gsub(", ,", "", gsub("\\\\n", "", gsub(
212-
"[()\"]", "", substr(sectionsString, 5, nchar(sectionsString))
213-
)))
201+
brokenDocumentation <- gsub("\\n", "",
202+
gsub(
203+
"[{}]", "", brokenDocumentation
204+
)
205+
)
206+
207+
description <-
208+
brokenDocumentation[grep("title", brokenDocumentation)]
209+
description <-
210+
gsub("title Data check", "", description, fixed = T)
214211

215212
samplePassData <-
216-
sectionsVector[match('samplePassData', sectionsVector) + 1]
213+
brokenDocumentation[grep("samplePassData", brokenDocumentation)]
214+
samplePassData <-
215+
gsub("section samplePassData", "", samplePassData, fixed = T)
216+
217217
sampleFailData <-
218-
sectionsVector[match('sampleFailData', sectionsVector) + 1]
218+
brokenDocumentation[grep("sampleFailData", brokenDocumentation)]
219+
sampleFailData <-
220+
gsub("section sampleFailData", "", sampleFailData, fixed = T)
221+
219222
checkCategory <-
220-
gsub(" ", "", sectionsVector[match('checkCategory', sectionsVector) + 1])
223+
brokenDocumentation[grep("checkCategory", brokenDocumentation)]
224+
checkCategory <-
225+
gsub("section checkCategory", "", checkCategory, fixed = T)
226+
221227
targetDWCField <-
222-
sectionsVector[match('targetDWCField', sectionsVector) + 1]
228+
brokenDocumentation[grep("targetDWCField", brokenDocumentation)]
229+
targetDWCField <-
230+
gsub("section targetDWCField", "", targetDWCField, fixed = T)
231+
223232
# ------ End of Parsing MetaData for check from .Rd file
224233

225234
temp <- list()

R/run_bdclean.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#' Launch bdclean Shiny Application
22
#'
3-
#'@import shiny shinydashboard shinyjs leaflet DT data.table rgbif spocc finch bdDwC bdchecks
3+
#'@import shinydashboard shinyjs leaflet data.table rgbif spocc finch bdDwC bdchecks tools
4+
#'@importFrom shiny runApp
45
#'
56
#'@export
67
run_bdclean <- function() {

cran-comments.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Resubmission
2+
This is a resubmission. In this version I have:
3+
4+
* Removed importsFrom from Description
5+
6+
* Added DOI references and URLs
7+
8+
-- R CMD check results -------------------------------------------------------------------- bdclean 0.1.12 ----
9+
Duration: 1m 33.8s
10+
11+
0 errors √ | 0 warnings √ | 0 notes √

0 commit comments

Comments
 (0)