powered by
Return a cyclic redundancy checksum for each element in the argument.
cksum(a)
numeric vector of the same length as a.
a
coerced to character vector
Steve Dutky sdutky@terpalum.umd.edu
NA's appearing in the argument are returned as NA's.
NA
The default calculation is identical to that given in pseudo-code in the ACM article (in the References).
Fashioned from cksum(1) UNIX command line utility, i.e., man cksum.
cksum(1)
man cksum
Dilip V. Sarwate (1988) Computation of Cyclic Redundancy Checks Via Table Lookup, Communications of the ACM 31, 8, 1008--1013.
bitShiftL, bitAnd, etc.
bitShiftL
bitAnd
b <- "I would rather have a bottle in front of me than frontal lobotomy\n" stopifnot(cksum(b) == 1342168430) (bv <- strsplit(b, " ")[[1]]) cksum(bv) # now a vector of length 13
Run the code above in your browser using DataLab