R/ck_create_seed_from_hash.R

Defines functions ck_create_seed_from_hash

ck_create_seed_from_hash <- function(x) {
  hash <- digest::sha1(x)
  hash <- unlist(strsplit(hash, ""))
  hash <- sapply(hash, function(x) {
    res <- suppressWarnings(as.numeric(x))
    ifelse(is.na(res), grep(x, letters), x)
  })
  as.integer(as.numeric(paste0("0.", paste(hash, collapse = ""))) * .Machine$integer.max)
}
sdcTools/cellKey documentation built on Dec. 5, 2023, 1:05 a.m.