diff --git a/R/create_attributes_table.R b/R/create_attributes_table.R index ff5b7ae..34d952b 100644 --- a/R/create_attributes_table.R +++ b/R/create_attributes_table.R @@ -553,8 +553,8 @@ table_to_r <- function(table) { table_colnames <- table$colnames out <- do.call(rbind, lapply(table_data, rbind)) - # Change NULL to NA in list - out[sapply(out, is.null)] <- NA + # Change NULL to empty string in list + out[sapply(out, is.null)] <- "" if (nrow(out) > 1) { out <- as.data.frame(apply(out, 2, unlist), stringsAsFactors = FALSE) @@ -565,6 +565,9 @@ table_to_r <- function(table) { } colnames(out) <- table_colnames + # Convert empty strings to missing values + out[sapply(out, function(f){(f == '')})] <- NA + out } @@ -621,7 +624,7 @@ build_factors <- function(att_table, data) { en_data <- lapply(seq_along(en_data), function(i) { attributeName <- colnames(en_data)[i] code <- unique(en_data[, i]) - definition <- NA + definition <- "" out <- data.frame(attributeName, code, definition, stringsAsFactors = FALSE) colnames(out) <- c("attributeName", "code", "definition") out <- out[!is.na(code),] diff --git a/R/obsolete_package.R b/R/obsolete_package.R index c6b8f4b..6337cce 100644 --- a/R/obsolete_package.R +++ b/R/obsolete_package.R @@ -7,12 +7,12 @@ #' [arcticdatautils::publish_update()] should be used. #' #' @param mn (MNode) The DataONE member node. -#' @param metadata_obsolete (character) The metadata PID of the old, or broken, version. Any -#' metadata PID from the obsolete version chain can be used - sets the PID to the -#' end of the version chain. -#' @param metadata_new (character) The metadata PID of the new version. Any metadata -#' PID from the new version chain can be used - sets the PID to the beginning of -#' the version chain. +#' @param metadata_obsolete (character) The metadata PID of the old, or broken, version. +#' Sets the PID to the beginning of the version chain (the entry at index=1 of the vector +#' returned by \code{arcticdatautils::get_all_versions}. +#' @param metadata_new (character) The metadata PID of the new version. Sets the PID to +#' the end of the version chain (the last item in the vector returned by +#' \code{arcticdatautils::get_all_versions}). #' #' @return (logical) `TRUE`/`FALSE` #' diff --git a/man/obsolete_package.Rd b/man/obsolete_package.Rd index 54df951..2fb47e7 100644 --- a/man/obsolete_package.Rd +++ b/man/obsolete_package.Rd @@ -9,13 +9,13 @@ obsolete_package(mn, metadata_obsolete, metadata_new) \arguments{ \item{mn}{(MNode) The DataONE member node.} -\item{metadata_obsolete}{(character) The metadata PID of the old, or broken, version. Any -metadata PID from the obsolete version chain can be used - sets the PID to the -end of the version chain.} +\item{metadata_obsolete}{(character) The metadata PID of the old, or broken, version. +Sets the PID to the beginning of the version chain (the entry at index=1 of the vector +returned by \code{arcticdatautils::get_all_versions}.} -\item{metadata_new}{(character) The metadata PID of the new version. Any metadata -PID from the new version chain can be used - sets the PID to the beginning of -the version chain.} +\item{metadata_new}{(character) The metadata PID of the new version. Sets the PID to +the end of the version chain (the last item in the vector returned by +\code{arcticdatautils::get_all_versions}).} } \value{ (logical) \code{TRUE}/\code{FALSE}