# pava.r: Interface to C code for PAVA (Pool Adjacent Violators Algorithm) # The file "pava.so" can be generated by the command: # R CMD SHLIB -O pava.c #*********************************************************************** dyn.load("pava.so") # load the compiled code pava = function(x, w=rep(1,length(x))) # R interface to the compiled code { n = length(x) if (n != length(w)) return (0) # error result = .C("pava", y = as.double(x), as.double(w), as.integer(n) ) result[["y"]] }