From 348620d4073021a4620a33002c8fbbd8bb7516fa Mon Sep 17 00:00:00 2001 From: Stephen Roecker Date: Mon, 27 Jan 2020 18:48:35 -0500 Subject: [PATCH] fixing fetchNASIS(from = "pedon_report") uncode was set to use local db, now using the cached metadata file --- R/fetchNASIS_pedons.R | 4 ++-- R/fetchNASIS_report.R | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/fetchNASIS_pedons.R b/R/fetchNASIS_pedons.R index 7f4dee46..2447a167 100644 --- a/R/fetchNASIS_pedons.R +++ b/R/fetchNASIS_pedons.R @@ -3,9 +3,9 @@ # get NASIS site/pedon/horizon/diagnostic feature data .fetchNASIS_pedons <- function(SS=TRUE, rmHzErrors=TRUE, nullFragsAreZero=TRUE, soilColorState='moist', lab=FALSE, stringsAsFactors = default.stringsAsFactors()) { - # test connection, should not be required, can be used if from = "pedon_report" + # test connection if(! 'nasis_local' %in% names(RODBC::odbcDataSources())) - warning('Local NASIS ODBC connection has not been setup. Please see `http://ncss-tech.github.io/AQP/soilDB/setup_local_nasis.html`.') + stop('Local NASIS ODBC connection has not been setup. Please see `http://ncss-tech.github.io/AQP/soilDB/setup_local_nasis.html`.') # sanity check if(! soilColorState %in% c('dry', 'moist')) diff --git a/R/fetchNASIS_report.R b/R/fetchNASIS_report.R index 4cab922e..bf08431d 100644 --- a/R/fetchNASIS_report.R +++ b/R/fetchNASIS_report.R @@ -41,7 +41,7 @@ # remove x2 <- x2[!is.na(x2$peiid), - ncol(x2)] idx <- names(x2) %in% c("pmkind", "pmorigin") - x2[!idx] <- uncode(x2[!idx]) + x2[!idx] <- uncode(x2[!idx], db = "LIMS") idx <- sapply(x2, is.character) x2[idx] <- lapply(x2[idx], function(x) ifelse(x == "", NA, x)) return(x2) @@ -154,7 +154,7 @@ # remove temp = temp[!is.na(temp$peiid), - ncol(temp)] idx = names(temp) %in% c("pmkind", "pmorigin") - temp[!idx] = uncode(temp[!idx]) + temp[!idx] = uncode(temp[!idx], db = "LIMS") idx = sapply(temp, is.character) temp[idx] = lapply(temp[idx], function(x) ifelse(x == "", NA, x)) # temp = within(temp, { @@ -193,7 +193,7 @@ # NASIS text reports return empty columns # remove temp = temp[!is.na(temp$peiid), - ncol(temp)] - temp = uncode(temp) + temp = uncode(temp, db = "LIMS") # temp = within(temp, { # obsdate = as.Date(as.character(obsdate)) # classdate = as.Date(as.character(classdate))