From 20a25a6f27143d1742ee1dbf63e4be013b40a5f7 Mon Sep 17 00:00:00 2001 From: Hongyuan Jia Date: Mon, 22 Feb 2021 11:42:38 +0800 Subject: [PATCH] [fix] Remove deprecated units functions from NAMESPACE --- NAMESPACE | 2 -- R/units.R | 23 +++++++++++------------ man/Epw.Rd | 2 +- man/Idf.Rd | 2 +- man/IdfObject.Rd | 4 ++-- man/get_idf_table.Rd | 2 +- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index e54250ff2..ca45ad2d2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -325,8 +325,6 @@ importFrom(stringi,stri_wrap) importFrom(tools,file_ext) importFrom(tools,file_path_sans_ext) importFrom(units,drop_units) -importFrom(units,install_conversion_constant) -importFrom(units,install_symbolic_unit) importFrom(units,set_units) importFrom(utils,capture.output) importFrom(utils,combn) diff --git a/R/units.R b/R/units.R index d4f030d91..73224953d 100644 --- a/R/units.R +++ b/R/units.R @@ -1,23 +1,22 @@ #' @importFrom data.table fread -#' @importFrom units install_symbolic_unit install_conversion_constant NULL # reg_custom_units {{{ reg_custom_units <- function () { tryCatch( { - if (packageVersion("units") < 0.7) { - install_symbolic_unit("person") - install_symbolic_unit("dollar") - install_symbolic_unit("thousandths") - install_conversion_constant("Wh", "J", 3.6E3) - install_conversion_constant("inH2O", "inch_H2O_39F", 1) + if (utils::packageVersion("units") < 0.7) { + units::install_symbolic_unit("person") + units::install_symbolic_unit("dollar") + units::install_symbolic_unit("thousandths") + units::install_conversion_constant("Wh", "J", 3.6E3) + units::install_conversion_constant("inH2O", "inch_H2O_39F", 1) } else { - install_unit("person") - install_unit("dollar") - install_unit("thousandths") - install_unit("Wh", "3.6E3 J") - install_unit("inH2O", "1 inch_H2O_39F") + units::install_unit("person") + units::install_unit("dollar") + units::install_unit("thousandths") + units::install_unit("Wh", "3.6E3 J") + units::install_unit("inH2O", "1 inch_H2O_39F") } TRUE }, diff --git a/man/Epw.Rd b/man/Epw.Rd index 4110ef805..f83d57fe0 100644 --- a/man/Epw.Rd +++ b/man/Epw.Rd @@ -1610,7 +1610,7 @@ Add units to weather data variables \subsection{Details}{ \verb{$add_unit()} assigns units to numeric weather data using -\code{\link[units:set_units]{units::set_units()}} if applicable. +\code{\link[units:units]{units::set_units()}} if applicable. \verb{$add_unit()} and diff --git a/man/Idf.Rd b/man/Idf.Rd index 15aab8cbf..09cc7f663 100644 --- a/man/Idf.Rd +++ b/man/Idf.Rd @@ -3632,7 +3632,7 @@ type being a string instead of a number. Default: \code{TRUE}.} \item{\code{unit}}{Only applicable when \code{string_value} is \code{FALSE}. If \code{TRUE}, values of numeric fields are assigned with units using -\code{\link[units:set_units]{units::set_units()}} if applicable. Default: \code{FALSE}.} +\code{\link[units:units]{units::set_units()}} if applicable. Default: \code{FALSE}.} \item{\code{wide}}{Only applicable if target objects belong to a same class. If \code{TRUE}, a wide table will be returned, i.e. first three diff --git a/man/IdfObject.Rd b/man/IdfObject.Rd index 8147da013..9351729c0 100644 --- a/man/IdfObject.Rd +++ b/man/IdfObject.Rd @@ -818,7 +818,7 @@ the \code{IdfObject} belongs to are returned. Default: \code{FALSE}} characters and the converted character vector is returned.} \item{\code{unit}}{If \code{TRUE}, values of numeric fields are assigned with -units using \code{\link[units:set_units]{units::set_units()}} if applicable. Default: +units using \code{\link[units:units]{units::set_units()}} if applicable. Default: \code{FALSE}.} } \if{html}{\out{}} @@ -1943,7 +1943,7 @@ type being a string instead of a number. Default: \code{TRUE}.} \item{\code{unit}}{Only applicable when \code{string_value} is \code{FALSE}. If \code{TRUE}, values of numeric fields are assigned with units using -\code{\link[units:set_units]{units::set_units()}} if applicable. Default: \code{FALSE}.} +\code{\link[units:units]{units::set_units()}} if applicable. Default: \code{FALSE}.} \item{\code{wide}}{Only applicable if target objects belong to a same class. If \code{TRUE}, a wide table will be returned, i.e. first three diff --git a/man/get_idf_table.Rd b/man/get_idf_table.Rd index 03c4bde19..4e2f8a14b 100644 --- a/man/get_idf_table.Rd +++ b/man/get_idf_table.Rd @@ -42,7 +42,7 @@ type being a string instead of a number. Default: \code{TRUE}.} \item{unit}{Only applicable when \code{string_value} is \code{FALSE}. If \code{TRUE}, values of numeric fields are assigned with units using -\code{\link[units:set_units]{units::set_units()}} if applicable. Default: \code{FALSE}.} +\code{\link[units:units]{units::set_units()}} if applicable. Default: \code{FALSE}.} \item{wide}{Only applicable if target objects belong to a same class. If \code{TRUE}, a wide table will be returned, i.e. first three