diff --git a/DESCRIPTION b/DESCRIPTION index b9ea9a8..543da83 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,7 +31,8 @@ Imports: rlang (>= 0.4.11), withr, tidyr, - glue + glue, + curl Config/testthat/edition: 3 Depends: R (>= 3.5.0) diff --git a/NAMESPACE b/NAMESPACE index 5d656ec..9b00b0d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,8 @@ # Generated by roxygen2: do not edit by hand export(.data) +export(get_ZB18a) +export(get_solution) export(snvec) importFrom(cli,cli_abort) importFrom(cli,cli_inform) diff --git a/R/data.R b/R/data.R index dd6c4fa..36af059 100644 --- a/R/data.R +++ b/R/data.R @@ -5,8 +5,11 @@ #' #' The HNBody output of Zeebe & Lourens (2019). #' -#' The wikipedia page on [Orbital elements](https://en.wikipedia.org/wiki/Orbital_elements) -#' describes what the components relate to in order to uniquely specify an orbital plane. +#' The wikipedia page on [Orbital +#' elements](https://en.wikipedia.org/wiki/Orbital_elements) describes what the +#' components relate to in order to uniquely specify an orbital plane. The +#' function asks to download the files to the user's cache directory so that they +#' can be accessed more quickly in the future. #' #' @format ## `ZB18a` #' A data frame with 250,001 rows and 20 columns: diff --git a/R/get_solution.R b/R/get_solution.R index cdb8ecc..60b2dd0 100644 --- a/R/get_solution.R +++ b/R/get_solution.R @@ -3,9 +3,16 @@ #' @param orbital_solution Character vector with the name of the orbital #' solution to use. One of `"ZB18a"` (default) from Zeebe and Lourens (2019), #' or `"La11"` (not yet implemented!). +# quiet and force are documented in get_ZB18a +#' @inheritParams get_ZB18a #' @seealso [get_ZB18a()] #' @inherit get_ZB18a references -get_solution <- function(orbital_solution = "ZB18a") { +#' @returns `get_solution()` returns a [tibble][tibble::tibble-package] with the +#' orbital solution input and some preprocessed new columns. +#' @examples +#' get_solution() +#' @export +get_solution <- function(orbital_solution = "ZB18a", quiet = FALSE) { solutions <- c("ZB18a", "La11") if (!orbital_solution %in% solutions) { cli::cli_abort(c("{.var orbital_solution} must be one of: {.or {.q {solutions}}}", @@ -14,7 +21,7 @@ get_solution <- function(orbital_solution = "ZB18a") { if (orbital_solution == "ZB18a") { # read in the (new?) cached result - dat <- get_ZB18a() + dat <- get_ZB18a(quiet = quiet) } if (orbital_solution == "La11") { ## dat <- snvecR::La11 @@ -27,16 +34,99 @@ get_solution <- function(orbital_solution = "ZB18a") { return(dat) } -#' Get the ZB18a solution from the cache +#' Get the ZB18a solution #' -# The cache is created in when the package is loaded, in zzz.R. +#' @param quiet Be quiet? +#' +#' * If `TRUE`, hide info messages. +#' +#' * If `FALSE` (the default) print info messages and timing. +#' @param force Force re-downloading the results, even if the solution is saved +#' to the cache. +#' @returns `get_ZB18a()` returns a [tibble][tibble::tibble-package] with the +#' orbital solution input and some preprocessed new columns. #' @rdname ZB18a -get_ZB18a <- function() { +#' @seealso [prepare_solution()] Processes orbital solution input to include +#' helper columns. +#' @examples +#' get_ZB18a() +#' @export +get_ZB18a <- function(quiet = FALSE, force = FALSE) { + ZB18a_url <- "http://www.soest.hawaii.edu/oceanography/faculty/zeebe_files/Astro/PrecTilt/OS/ZB18a/ems-plan3.dat" + cachedir <- tools::R_user_dir("snvecR", which = "cache") - ZB18apath <- paste0(cachedir, "/ZB18a.rds") + raw_path <- paste0(cachedir, "/ems-plan3.dat") + csv_path <- paste0(cachedir, "/ZB18a.csv") + rds_path <- paste0(cachedir, "/ZB18a.rds") + + # if it doesn't exist, or the user wants to override the file + if (!file.exists(rds_path) || force) { + if (!file.exists(csv_path) || force) { + if (!quiet) cli::cli_alert_info("The orbital solution ZB18a has not been downloaded.") + + # default to Yes downloading if not interactive (i.e. GitHub actions) + if (!interactive()) { + download <- TRUE + # default to no caching, so that we're not writing to the user's directory + save_cache <- FALSE + } else {# we're interactive + # a logical, TRUE if Yes, no if otherwise + download <- utils::menu(c("Yes", "No"), title = "Would you like to download and process it now?") == 1L + } + + # the user would NOT like to download and process the orbital solution + if (!download) { + cli::cli_abort("Cannot `get_ZB18a()` without downloading the file.") + } else {# the user would like to download and process the orbital solution + if (interactive()) { + save_cache <- utils::menu(c("Yes", "No"), title = "Would you like to save the results to the cache?") == 1L + } + + if (!quiet) cli::cli_alert_info("Reading {.file {basename(raw_path)}} from website {.url {ZB18a_url}}.") + + # read the file from the website + ZB18a <- readr::read_table(ZB18a_url, + col_names = c("t", # time in days + "aa", # semimajor axis + "ee", # eccentricity + "inc", # inclination + "lph", # long periapse + "lan", # long ascending node + "arp", # argument of periapse + "mna"), # mean anomaly + skip = 3, + comment = "#") #|> + + if (save_cache) { + dir.create(cachedir, recursive = TRUE, showWarnings = FALSE) + if (!quiet) cli::cli_alert_info("The cache directory is {.file {cachedir}}.") + # also copy the raw file to disk, even though we've read it in using read_table directly + curl::curl_download(ZB18a_url, destfile = raw_path) + if (!quiet) cli::cli_alert_info("Saved {.file {basename(raw_path)}} to cache.") + + # write intermediate result to csv + readr::write_csv(ZB18a, csv_path) + if (!quiet) cli::cli_alert_info("Saved cleaned-up {.file {basename(csv_path)}} to cache.") + } + } + } else {# if we've downloaded the file but haven't prepared the solution somehow + ZB18a <- readr::read_csv(csv_path) + } + + # prepare the solution (i.e. calculate helper columns) + ZB18a <- ZB18a |> + prepare_solution() + + if (save_cache) { + readr::write_rds(ZB18a, rds_path) + if (!quiet) { + cli::cli_alert("Saved solution with helper columns {.file {basename(rds_path)}} to cache.", + "i" = "Future runs will read from the cache, unless you specify `force = TRUE`.") + } + } + } else {# if the rds file already exist, read it from the cache + ZB18a <- readr::read_rds(rds_path) + } - # if you picked no during the onLoad, I assume read_rds will tell you the - # file doesn't exist - ZB18a <- readr::read_rds(ZB18apath) return(ZB18a) } diff --git a/R/interpolation.R b/R/interpolation.R index ceb347a..3b90f2c 100644 --- a/R/interpolation.R +++ b/R/interpolation.R @@ -1,18 +1,15 @@ -## using approxfun -## http://desolve.r-forge.r-project.org/ has an article on time-varying inputs -## we can use approxfun to generate a function that approximates =col= for timestep t. +# using approxfun +# http://desolve.r-forge.r-project.org/ has an article on time-varying inputs +# we can use approxfun to generate a function that approximates =col= for timestep t. - -##' Linearly interpolate a dataframe. -##' -##' @param dat The dataframe. -##' @param col A character vector with the column we want to interpolate on. -##' @returns A function that predicts `col` as a function of `t` in `dat`. -##' -##' @seealso [qinterp()] for quick interpolation of a single timestep. -##' @importFrom stats approxfun -##' @importFrom dplyr select -##' @noRd +#' Linearly interpolate a dataframe. +#' +#' @param dat The dataframe. +#' @param col A character vector with the column we want to interpolate on. +#' @returns A function that predicts `col` as a function of `t` in `dat`. +#' +#' @seealso [qinterp()] for quick interpolation of a single timestep. +#' @noRd approxdat <- function(dat, col) { # I'm not putting any input checks because it's an internal function dat |> @@ -20,28 +17,24 @@ approxdat <- function(dat, col) { approxfun(rule = 2) } -## implement qinterp similar to the C-routine -## :PROPERTIES: -## :header-args:R: :tangle R/interpolation.R :comments org :session *R:snvec-R* :exports both :results output :eval no-export -## :END: - -##' Quickly interpolate a single value. -##' -##' `qinterp()` is a custom linear interpolation algorithm that is much faster -##' than using the full vectorized `[approx()]` or `[approxfun()]`, because it -##' only interpolates the single value of the current timestep. -##' -##' @param y The vector to interpolate. -##' @param ds The difference in timestep in the astronomical solution. -##' @param dx The difference between the current timestep and the timestep in the astronomical solution. -##' @param m The index variable of the current position in the astronomical solution. -##' @returns The vector of interpolated results. -##' @examples -##' # interpolate ZB18a$lph[[1:4]] -##' qinterp(ZB18a$lph[[1:4]], ds = -146100, dx = -18262.5, m = 2) -##' -##' @seealso [approxdat()] for linear interpolation of the full astronomical solution. -##' @noRd +# implement qinterp similar to the C-routine +#' Quickly interpolate a single value. +#' +#' `qinterp()` is a custom linear interpolation algorithm that is much faster +#' than using the full vectorized `[approx()]` or `[approxfun()]`, because it +#' only interpolates the single value of the current timestep. +#' +#' @param y The vector to interpolate. +#' @param ds The difference in timestep in the astronomical solution. +#' @param dx The difference between the current timestep and the timestep in the astronomical solution. +#' @param m The index variable of the current position in the astronomical solution. +#' @returns The vector of interpolated results. +#' @examples +#' # interpolate ZB18a$lph[[1:4]] +#' qinterp(ZB18a$lph[[1:4]], ds = -146100, dx = -18262.5, m = 2) +#' +#' @seealso [approxdat()] for linear interpolation of the full astronomical solution. +#' @noRd qinterp <- function(y, ds, dx, m) { yi <- y[m] dy <- 0 diff --git a/R/prepare_solution.R b/R/prepare_solution.R index f0d3c58..ecde397 100644 --- a/R/prepare_solution.R +++ b/R/prepare_solution.R @@ -9,7 +9,8 @@ #' * `lph` Longitude of perihelion \eqn{\varpi} (degrees). #' * `lan` Longitude of the ascending node \eqn{\Omega} (degrees). #' * `inc` Inclination \eqn{I} (degrees). -#' +# inherit quiet +#' @inheritParams get_ZB18a #' @returns A [tibble][tibble::tibble-package] with the new columns added. #' @seealso [get_ZB18a()] [get_solution()] #' @@ -43,18 +44,18 @@ # \item{npx, npy, npz}{The \eqn{x}, \eqn{y}, and \eqn{z}-components of the unit # normal vector \eqn{\vec{n}'}{n'}, relative to ECLIPJ2000.} # IOP = instantaneous orbit plane -prepare_solution <- function(data) { +prepare_solution <- function(data, quiet = FALSE) { if (!all(c("lph", "lan", "t", "inc") %in% colnames(data))) { cli::cli_abort("Column names 't', 'lph', 'lan', 'inc' must be in data.") } - cli::cli_alert_info("Calculating helper columns") + if (!quiet) cli::cli_alert_info("Calculating helper columns.") data |> dplyr::mutate( lphu = unwrap(.data$lph), lanu = unwrap(.data$lan) ) |> - dplyr::mutate(age = -.data$t / KY2D, .after = .data$t) |> + dplyr::mutate(age = -.data$t / KY2D, .after = "t") |> dplyr::mutate( hh = .data$ee * sin(.data$lph / R2D), kk = .data$ee * cos(.data$lph / R2D), diff --git a/R/snvec.R b/R/snvec.R index a94c6ff..a276fbf 100644 --- a/R/snvec.R +++ b/R/snvec.R @@ -11,6 +11,7 @@ #' Defaults to `1.0`. #' @param td Tidal dissipation \eqn{T_{d}}{Td}, normalized to modern. Defaults #' to `0.0`. +# orbital_solution comes from get_solution #' @inheritParams get_solution #' @param tres Output timestep resolution in thousands of years (kyr). Defaults #' to `0.4`. @@ -21,12 +22,9 @@ #' @param solver Character vector specifying the method passed to #' [deSolve::ode()]'s `method`. Defaults to `"vode"` for stiff problems #' with a variable timestep. -#' @param quiet Be quiet? -#' -#' * If `TRUE`, hide info messages. -#' -#' * If `FALSE` (the default) print info messages and timing. -#' +# quiet comes from get_ZB18a. Force does too, but I hope that because we don't +# use it here, it won't get inherited. +#' @inheritParams get_ZB18a #' @param output Character vector with name of desired output. One of: #' #' * `"nice"` (the default) A [tibble][tibble::tibble-package] with the @@ -45,8 +43,7 @@ #' 2010) means that the R routine returns an evenly-spaced time grid, whereas #' the C-routine has a variable time-step. #' -#' @returns `snvec()` returns different output depending on the `outputs` -#' argument. +#' @returns `snvec()` returns different output depending on the `outputs` argument. #' #' If `output = "nice"` (the default), returns a #' [tibble][tibble::tibble-package] with the following columns: @@ -102,8 +99,15 @@ #' `sy`, and `sz` (see above). This can be useful for i.e. #' [deSolve::diagnostics()]. #' -#' @seealso [deSolve::ode()] from Soetaert et al., (2010) for the ODE solver -#' that we use. +#' @seealso +#' +#' * [deSolve::ode()] from Soetaert et al., (2010) for the ODE solver that we +#' use. +#' +#' * [get_ZB18a()] Documents the default orbital solution input. +#' +#' * [get_solution()] A general function that in the future may be used to get +#' other orbital solutions. #' #' @references #' @@ -144,22 +148,20 @@ snvec <- function(tend = -1e3, quiet = FALSE, output = "nice") { - dat <- get_solution(orbital_solution = orbital_solution) - outputs <- c("nice", "all", "ode") if (!output %in% outputs) { - cli::cli_abort(c("{.var output} must be one of {.or {.q {outputs}}}", - "x" = "You've supplied {.q {output}}")) + cli::cli_abort(c("{.var output} must be one of {.or {.q {outputs}}}.", + "x" = "You've supplied {.q {output}}.")) } ## tend if (tend >= 0) { - cli::cli_abort(c("{.var tend} must be < 0", - "x" = "You've supplied {tend}" + cli::cli_abort(c("{.var tend} must be < 0.", + "x" = "You've supplied {tend}." )) } - if (tend < min(dat$t / KY2D)) { - cli::cli_abort(c("{.var tend} must be > the orbital solution {min(dat$t)/KY2D}", - "x" = "You've supplied {tend}" + if (tend < -1e5) { + cli::cli_abort(c("{.var tend} must be > the orbital solution {-1e5}, e.g. -100 Ma.", + "x" = "You've supplied {tend}." )) } @@ -182,13 +184,13 @@ snvec <- function(tend = -1e3, if (ed < .9 | ed > 1.1) { cli::cli_warn(c("!" = "Dynamic ellipticity likely varied between 0.9980 and 1.0005 during the past 45 Ma!", "i" = "{.var ed} = {ed}", - "*" = "See Zeebe & Lourens 2022 Pal&Pal ")) + "*" = "See Zeebe & Lourens 2022 Pal&Pal .")) } if (td < 0 | td > 1.2) { cli::cli_warn(c("Tidal dissipation likely varied between 0 and 1!", "i" = "{.var td} = {td}", - "*" = "See Zeebe & Lourens 2022 Pal&Pal ")) + "*" = "See Zeebe & Lourens 2022 Pal&Pal .")) } if (atol < 1e-12 | atol > 1e-3) { @@ -198,6 +200,8 @@ snvec <- function(tend = -1e3, cli::cli_warn("Input relative tolerance should be smaller than 1e-3.") } + dat <- get_solution(orbital_solution = orbital_solution) + # message user about inputs if (!quiet) { startdate <- lubridate::now() diff --git a/R/snvecR-package.R b/R/snvecR-package.R index 2a0a2a4..b603e80 100644 --- a/R/snvecR-package.R +++ b/R/snvecR-package.R @@ -10,6 +10,7 @@ #' @importFrom purrr map2_dbl #' @importFrom readr write_rds read_rds read_table #' @importFrom rlang .data +#' @importFrom stats approxfun #' @importFrom tibble tibble #' @importFrom tidyr unnest #' @importFrom tidyselect all_of diff --git a/R/unwrap.R b/R/unwrap.R index 4d4a03a..be74c7e 100644 --- a/R/unwrap.R +++ b/R/unwrap.R @@ -1,15 +1,6 @@ -## unwrap function -## :PROPERTIES: -## :header-args:R: :tangle R/unwrap.R :comments org :session *R:snvec-R* :exports both :results output :eval no-export -## :END: -## :LOGBOOK: -## - State "SOME" from [2023-03-24 Fri 14:38] -## :END: -## [[file:snvec-3.7.5/snvec-3.7.5.c::=== unwrap()][unwrap()]] - -#' unwrap angle. +#' Unwrap angle. #' -#' Unwrap angle. Maps jumps greater than pi to their 2pi complement. +#' Maps jumps greater than pi to their 2pi complement. #' #' @param y Input vector in degrees. #' @returns Unwrapped vector in degrees. diff --git a/R/zzz.R b/R/zzz.R deleted file mode 100644 index 1502f7e..0000000 --- a/R/zzz.R +++ /dev/null @@ -1,50 +0,0 @@ -.onLoad <- function(libname, pkgname) { - cachedir <- tools::R_user_dir("snvecR", which = "cache") - csv_path <- paste0(cachedir, "/ZB18a.csv") - rds_path <- paste0(cachedir, "/ZB18a.rds") - - # if it doesn't exist - if (!file.exists(rds_path)) { - if (!file.exists(csv_path)) { - cli::cli_alert_info("The orbital solution ZB18a has not been downloaded.") - ZB18a_url <- "http://www.soest.hawaii.edu/oceanography/faculty/zeebe_files/Astro/PrecTilt/OS/ZB18a/ems-plan3.dat" - - # ask user to download it - if (interactive()) { - choice <- utils::menu(c("Yes", "No"), title = "Would you like to download and process it now?") - } else { - # default to Yes if not interactive (i.e. GitHub actions) - choice <- 1L - } - - if (choice == 1L) { - dir.create(cachedir, recursive = TRUE, showWarnings = FALSE) - cli::cli_alert_info("Downloading ems-plan3.dat from website {ZB18a_url}.") - - # read the file from the website - ZB18a <- readr::read_table(ZB18a_url, - col_names = c("t", # time in days - "aa", # semimajor axis - "ee", # eccentricity - "inc", # inclination - "lph", # long periapse - "lan", # long ascending node - "arp", # argument of periapse - "mna"), # mean anomaly - skip = 3, - comment = "#") |> - # write intermediate result to csv - readr::write_csv(csv_path) - cli::cli_alert_info("Saved cleaned-up file as ZB18a.csv") - } - } else {# if we've downloaded the file but haven't prepared the solution somehow - ZB18a <- readr::read_csv(csv_path) - } - - # prepare the solution and save to rds - ZB18a <- ZB18a |> - prepare_solution() |> - readr::write_rds(rds_path) - cli::cli_alert_info("Saved solution with helper columns to {rds_path}") - } -} diff --git a/README.Rmd b/README.Rmd index ad247db..69cc588 100644 --- a/README.Rmd +++ b/README.Rmd @@ -41,6 +41,12 @@ You can install snvecR like so: install.packages("snvecR") ``` +To use the development version of the package, use: + +```r +remotes::install_github("japhir/snvecR") +``` + ## Example Here's the main function that does the work in action: diff --git a/README.md b/README.md index 1682df9..b412c67 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,12 @@ You can install snvecR like so: install.packages("snvecR") ``` +To use the development version of the package, use: + +``` r +remotes::install_github("japhir/snvecR") +``` + ## Example Here’s the main function that does the work in action: @@ -48,15 +54,15 @@ solution <- snvec() #> • `atol` = 1e-05 #> • `rtol` = 0 #> • `solver` = "vode" -#> ℹ started at "2023-04-25 13:41:24.335834" +#> ℹ started at "2023-05-08 13:39:45.6343" #> Final values: #> • s[1][2][3]: 0.404184487124565 -0.0537555129057148 0.913036138471423 #> • s-error = |s|-1: 0.353152142725588 #> Final values: #> • obliquity: 0.413060472710089 rad #> • precession: -0.562357122261027 rad -#> ℹ stopped at "2023-04-25 13:41:25.580669" -#> ℹ total duration: 1.25s +#> ℹ stopped at "2023-05-08 13:39:47.579519" +#> ℹ total duration: 1.95s ``` see `?snvec` for further documentation. diff --git a/data-raw/ZB18a.R b/data-raw/ZB18a.R index 0b9c403..8cdf1cb 100644 --- a/data-raw/ZB18a.R +++ b/data-raw/ZB18a.R @@ -98,3 +98,5 @@ usethis::use_data(ZB18a, ) rm(dat) + +# all of this is now a part of the fuction get_ZB18a()! diff --git a/man/ZB18a.Rd b/man/ZB18a.Rd index c897df0..f589267 100644 --- a/man/ZB18a.Rd +++ b/man/ZB18a.Rd @@ -57,17 +57,40 @@ instantaneous orbital plane.} } } \usage{ -get_ZB18a() +get_ZB18a(quiet = FALSE, force = FALSE) +} +\arguments{ +\item{quiet}{Be quiet? +\itemize{ +\item If \code{TRUE}, hide info messages. +\item If \code{FALSE} (the default) print info messages and timing. +}} + +\item{force}{Force re-downloading the results, even if the solution is saved +to the cache.} +} +\value{ +\code{get_ZB18a()} returns a \link[tibble:tibble-package]{tibble} with the +orbital solution input and some preprocessed new columns. } \description{ The HNBody output of Zeebe & Lourens (2019). } \details{ -The wikipedia page on \href{https://en.wikipedia.org/wiki/Orbital_elements}{Orbital elements} -describes what the components relate to in order to uniquely specify an orbital plane. +The wikipedia page on \href{https://en.wikipedia.org/wiki/Orbital_elements}{Orbital elements} describes what the +components relate to in order to uniquely specify an orbital plane. The +function asks to download the files to the user's cache directory so that they +can be accessed more quickly in the future. +} +\examples{ +get_ZB18a() } \references{ Zeebe, R. E., & Lourens, L. J. (2019). Solar System chaos and the Paleocene–Eocene boundary age constrained by geology and astronomy. \emph{Science}, 365(6456), 926–929. \doi{10.1126/science.aax0612}. } +\seealso{ +\code{\link[=prepare_solution]{prepare_solution()}} Processes orbital solution input to include +helper columns. +} diff --git a/man/get_solution.Rd b/man/get_solution.Rd index e29c162..446e92e 100644 --- a/man/get_solution.Rd +++ b/man/get_solution.Rd @@ -4,16 +4,29 @@ \alias{get_solution} \title{Get an Orbital Solution} \usage{ -get_solution(orbital_solution = "ZB18a") +get_solution(orbital_solution = "ZB18a", quiet = FALSE) } \arguments{ \item{orbital_solution}{Character vector with the name of the orbital solution to use. One of \code{"ZB18a"} (default) from Zeebe and Lourens (2019), or \code{"La11"} (not yet implemented!).} + +\item{quiet}{Be quiet? +\itemize{ +\item If \code{TRUE}, hide info messages. +\item If \code{FALSE} (the default) print info messages and timing. +}} +} +\value{ +\code{get_solution()} returns a \link[tibble:tibble-package]{tibble} with the +orbital solution input and some preprocessed new columns. } \description{ Get an Orbital Solution } +\examples{ +get_solution() +} \references{ Zeebe, R. E., & Lourens, L. J. (2019). Solar System chaos and the Paleocene–Eocene boundary age constrained by geology and astronomy. diff --git a/man/prepare_solution.Rd b/man/prepare_solution.Rd index 6f8dc12..c6ed9be 100644 --- a/man/prepare_solution.Rd +++ b/man/prepare_solution.Rd @@ -4,7 +4,7 @@ \alias{prepare_solution} \title{Prepare Orbital Solution} \usage{ -prepare_solution(data) +prepare_solution(data, quiet = FALSE) } \arguments{ \item{data}{The output of \code{\link[=get_solution]{get_solution()}}. @@ -15,6 +15,12 @@ It needs to contain columns: \item \code{lan} Longitude of the ascending node \eqn{\Omega} (degrees). \item \code{inc} Inclination \eqn{I} (degrees). }} + +\item{quiet}{Be quiet? +\itemize{ +\item If \code{TRUE}, hide info messages. +\item If \code{FALSE} (the default) print info messages and timing. +}} } \value{ A \link[tibble:tibble-package]{tibble} with the new columns added. diff --git a/man/snvec.Rd b/man/snvec.Rd index 62c6bdf..87fff05 100644 --- a/man/snvec.Rd +++ b/man/snvec.Rd @@ -60,8 +60,7 @@ interpolated columns. }} } \value{ -\code{snvec()} returns different output depending on the \code{outputs} -argument. +\code{snvec()} returns different output depending on the \code{outputs} argument. If \code{output = "nice"} (the default), returns a \link[tibble:tibble-package]{tibble} with the following columns: @@ -136,6 +135,11 @@ Differential Equations in R: Package deSolve. Journal of Statistical Software, 33(9), 1–25. \doi{10.18637/jss.v033.i09}. } \seealso{ -\code{\link[deSolve:ode]{deSolve::ode()}} from Soetaert et al., (2010) for the ODE solver -that we use. +\itemize{ +\item \code{\link[deSolve:ode]{deSolve::ode()}} from Soetaert et al., (2010) for the ODE solver that we +use. +\item \code{\link[=get_ZB18a]{get_ZB18a()}} Documents the default orbital solution input. +\item \code{\link[=get_solution]{get_solution()}} A general function that in the future may be used to get +other orbital solutions. +} } diff --git a/tests/testthat/test-snvec.R b/tests/testthat/test-snvec.R index 941469e..4e4df79 100644 --- a/tests/testthat/test-snvec.R +++ b/tests/testthat/test-snvec.R @@ -1,6 +1,5 @@ test_that("snvec() inputs are checked", { - expect_error(snvec(orbital_solution = "hoi")) - expect_error(snvec(orbital_solution = "La11")) + # we test the orbital_solution inputs for the get_solution helper in stead expect_error(snvec(tend = -Inf)) expect_error(snvec(tend = 5)) expect_error(snvec(tres = -5))