From e5424065fa4dc11753c2954ad7f7b3e2a6607ce0 Mon Sep 17 00:00:00 2001 From: "Andrew G. Brown" Date: Wed, 15 Nov 2023 13:32:58 -0800 Subject: [PATCH] get_SDA_coecoclass: aggregate queries more efficient handling of multi-areasymbol input --- R/get_SDA_coecoclass.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/get_SDA_coecoclass.R b/R/get_SDA_coecoclass.R index 1769dd11..2d45aae3 100644 --- a/R/get_SDA_coecoclass.R +++ b/R/get_SDA_coecoclass.R @@ -161,13 +161,11 @@ get_SDA_coecoclass <- function(method = "None", mukey <- NULL; .N <- NULL; .SD <- NULL; .GRP <- NULL; if (!is.null(areasymbols)) { - res0 <- do.call('rbind', lapply(areasymbols, function(x) { - .SSURGO_query(paste0( + res0 <- .SSURGO_query(paste0( "SELECT DISTINCT mukey, nationalmusym, muname FROM mapunit INNER JOIN legend ON legend.lkey = mapunit.lkey - WHERE areasymbol = '", x, "'" + WHERE areasymbol IN ", format_SQL_in_statement(areasymbols) )) - })) idx <- makeChunks(res0$mukey, 1000) l <- split(res0$mukey, idx) } else {