Skip to content

Commit

Permalink
Remove as.CalDates.cal()
Browse files Browse the repository at this point in the history
This was no longer functional after 9ca48c0. To revive it we need a way to retain or reconstruct the metadata contained within CalDates, see #11
  • Loading branch information
joeroe committed Feb 4, 2022
1 parent f46ee8c commit 000c1c4
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 82 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ S3method(vec_ptype_abbr,c14_curve_14c)
S3method(vec_ptype_abbr,c14_curve_f14c)
S3method(vec_ptype_full,c14_cal)
export("%>%")
export(as.CalDates.cal)
export(as_cal)
export(c14_age)
export(c14_age_norm)
Expand Down
36 changes: 0 additions & 36 deletions R/cal_convert.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,39 +135,3 @@ as_cal.BchronCalibratedDates <- function(x) {
purrr::map(~data.frame(year = .x$ageGrid, p = .x$densities)) %>%
purrr::map(new_cal)
}


# Reverse conversions -----------------------------------------------------

#' Convert cal objects to an rcarbon CalDates object
#'
#' @param x A list of `cal` objects.
#'
#' @return
#' A `CalDates` object. See [rcarbon::calibrate()] for details.
#'
#' @family c14 conversion functions
#'
#' @export
as.CalDates.cal <- function(x) {
x <- purrr::map(x, cal_repair_calibration_range)

metadata <- purrr::map(x, cal_metadata)
metadata <- purrr::map_dfr(metadata, cal_recode_metadata,
from = "cal", to = "CalDates")
metadata <- as.data.frame(metadata)

grids <- purrr::map(x, data.frame)
grids <- purrr::map(grids, structure,
class = c("calGrid", "data.frame"),
names = c("calBP", "PrDens"))

calMatrix <- NA

CalDates <- list(metadata = metadata,
grids = grids,
calMatrix = calMatrix)
class(CalDates) <- c("CalDates", "list")

return(CalDates)
}
19 changes: 0 additions & 19 deletions R/cal_metadata.R

This file was deleted.

22 changes: 0 additions & 22 deletions man/as.CalDates.cal.Rd

This file was deleted.

4 changes: 0 additions & 4 deletions man/as_cal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 000c1c4

Please sign in to comment.