Skip to content

Post-BP dates and multiplot – solution: tweak BPtoBCAD() to give warning() rather than stop()? #67

Description

@tcwilkinson

Noticed that multiplot() will throw error and not plot when using BC/AD mode when there are dates with post-BP/post-bomb values.

It seems that this is caused by the BPtoBCAD() function choking on conversion.

BPtoBCAD <- function(x){
  index <- !is.na(x)
  if (any(x[index] < 0)){ stop("Post-bomb dates (<0 BP) are not currently supported.") }
  res <- matrix(c(x, rep(NA,length(x))), ncol=2)
  res[index & x < 1950,2] <- 1950-res[index & x < 1950,1]
  res[index & x >= 1950,2] <- 1949-res[index & x >= 1950,1]
  return(res[,2])
}

Meanwhile the same dates plot fine using the BP mode. There may be good reasons to exclude them, but feel it might better to give users advice than blank refusal just because of the scale.

Would you consider switching stop() to warning() to allow these to be plotted?

Can PR it if needed, though it's a really teeny one!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions