Skip to content

Commit c9d56f3

Browse files
committed
load_tree_data(): ensure PLT_CN is character type
1 parent 8f7e049 commit c9d56f3

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

R/load_tree_data.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
#' Column names are case-sensitive in \pkg{FIAstemmap} functions, and are
9393
#' assumed to follow the FIADB upper case naming convention.
9494
#'
95+
#' If column `PLT_CN` is present, it will be read or coerced if necessary to R
96+
#' `"character"` type consistent with its data type in FIADB (i.e., a string
97+
#' but all digits).
98+
#'
9599
#' @seealso
96100
#' [DEFAULT_TREE_COLUMNS]
97101
#'
@@ -229,6 +233,9 @@ load_tree_data <- function(src, table = NULL, columns = DEFAULT_TREE_COLUMNS,
229233
class(d) <- "data.frame"
230234
attr(d, "gis") <- NULL
231235

236+
if ("PLT_CN" %in% colnames(d) && storage.mode(d$PLT_CN) != "character")
237+
storage.mode(d$PLT_CN) <- "character"
238+
232239
if (nrow(d) == 0)
233240
cli::cli_alert_danger("No tree records were returned")
234241
else

man/load_tree_data.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)