Skip to content

Commit

Permalink
Don't convert all-caps field names to camelCase
Browse files Browse the repository at this point in the history
Fixes #62
  • Loading branch information
matildastevenson committed Jul 20, 2021
1 parent bf449d1 commit eeae3eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions R/utilities_internal.R
Expand Up @@ -51,8 +51,11 @@ rename_columns <- function(varnames, type) {
} else if (type == "occurrence") {
# change dots to camel case
varnames <- gsub("\\.(\\w?)", "\\U\\1", varnames, perl = TRUE)
# replace first letters with lowercase
substr(varnames, 1, 1) <- tolower(substr(varnames, 1, 1))
# replace first letters with lowercase, but only if it is not an
# all-uppercase field name (which assertions are)
not_all_uppercase <- str_detect(varnames, "[[:lower:]]")
substr(varnames[not_all_uppercase], 1, 1) <-
tolower(substr(varnames[not_all_uppercase], 1, 1))
}
varnames
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-ala_occurrences.R
Expand Up @@ -71,7 +71,7 @@ test_that("ala occurrences returns requested columns", {

test_that("ala occurrences handles assertion columns and works with data.frame
input", {
skip("qa field ignored by ALA")
skip_on_cran()
id <- select_taxa("Paraparatrechina minutula")
cols <- select_columns("ZERO_COORDINATE", "eventDate")
expect_equal(names(ala_occurrences(taxa = id, columns = cols)),
Expand Down

0 comments on commit eeae3eb

Please sign in to comment.