R/raw.getMD5.R

Defines functions raw.getPartialMD5str raw.getMD5str raw.getPartialMD5 raw.getMD5

Documented in raw.getMD5 raw.getMD5str raw.getPartialMD5 raw.getPartialMD5str

#' returns the MD5sum of a filename
#'
#' @param filename filename
#' @param num string length
#' @return CRC MD5 sum for this particular file
#' @importFrom tools md5sum
#' @examples
#' raw.getMD5(raw.getSampleFiles(),num=10)
#'
#' @export
raw.getMD5 <- function(filename,num=6) {
  fdel=c()
  for(c in 1:length(filename)) {
    if (!file.exists(filename[c])) { fdel=c(fdel,c) }
  }
  # remove files that cannot be found
  if(length(fdel)>0) filename=filename[-fdel]
  substr(md5sum(filename),1,num)
}

#' returns the MD5sum of a filename
#'
#' @param filename filename
#' @param num string length
#' @return CRC MD5 sum for this particular file
#' @export
raw.getPartialMD5 <- function(filename,num=6) { raw.getMD5(filename, num) }


#' returns a string with all MD5 files
#'
#' @param filename filename with path
#' @return CRC MD5 sum for this particular file
#' @examples
#' raw.getMD5str(raw.getSampleFiles())
#'
#' @export
raw.getMD5str <- function(filename) {
  paste0(as.vector(raw.getMD5(filename)),collapse=',')
}


#' returns a string with all MD5 files
#'
#' @param filename filename with path
#' @return CRC MD5 sum for this particular file
#' @export
raw.getPartialMD5str <- function(filename) { raw.getMD5str(filename) }
thomasgredig/RAWdataR documentation built on Nov. 6, 2024, 9:46 a.m.