R/whichKey.R

Defines functions whichKey

Documented in whichKey

#' Show the key filename used to encode the subject hour confirmations
#'
#' The function computes the filename which is based on the timestamp. Copy the
#' timestamp on the PDF generated by \link{genSubjHconf} and use the function
#' to generate the filename of the key (to find it again in your file system).
#' See example below.
#'
#' @param timestamp String with copied timestamp from PDFs generated by the
#' function \link{genSubjHconf}. Be aware that there may be two different
#' minus signs: a unicode one (e.g., from the pdf) an a ASCII (e.g.,
#' internal R use). The function  corrects it to the ASCII version, however,
#' depending on the typset used in the PDF there may be also other
#' encoding problems, which should be corrected by hand (e.g., by substituting
#' the characters).
#' #' @return Returns a string with the key file name based on the given timestamp.
#'
#' @author Axel Zinkernagel \email{zinkernagel@uni-landau.de}
#'
#' @examples
#' # Show keyname for timestamp "1970−01−01 00:00:01"
#' whichKey("1970−01−01 00:00:01")
#'
#' # dummykey_313937302d30312d30312030303a30303a3031.rda is the example key
#' # provided with this package
#'
#' @export
whichKey <- function(timestamp){
  timestamp4save <- as.character(timestamp)
  timestamp4save <- charToRaw(timestamp4save)
  timestamp4save <- as.character(timestamp4save)
  timestamp4save <- paste(timestamp4save, collapse = "")
  timestamp4save <- gsub("e28892","2d",timestamp4save)
  timestamp4save <- paste0("key_",timestamp4save,".rda")
  return(timestamp4save)
}
axzinker/axBoost documentation built on July 4, 2024, 9:14 p.m.