是否有更简单的方法为R中的包生成MD5校验和?

时间:2016-07-22 19:15:51

标签: r md5 checksum

目前我正在使用以下方式为包生成MD5校验和:

library(tools)
#the files in the package main directory and subdirectories
names = (list.files("package_directory/", recursive = T)) 
files = do.call(paste, list("package_directory", names, sep = "")) 
#pasting the directory name so it forms a complete filename, can be skipped 
##if you set your working directory to the same directory as the package

#md5 checksum generation
md5 = as.vector(md5sum(files))
#aggregating it in a file
expt = do.call(paste, list(md5, names, sep = " *"))
#and writing it to the package directory
write(expt, "package_directory/MD5")

我刚刚开始冒险开发包,我不确定这种方法是否总是有效。那么,做这一切的聪明方法是什么?

0 个答案:

没有答案