lmom.R 445 Bytes
Newer Older
Jean-Marie Lepioufle's avatar
Jean-Marie Lepioufle committed
1
2
3
#' samlur

#' samlur
4
#' @param x tbl_friendlyts data.frame
Jean-Marie Lepioufle's avatar
Jean-Marie Lepioufle committed
5
6
7
8
9
10
11
#' @param target target in character
#' @keywords basicr
#' @export
#' @examples
#' \dontrun{
#' samlmu2()
#' }
12
samlmu2 <- function(x,target) {
Jean-Marie Lepioufle's avatar
Jean-Marie Lepioufle committed
13

14
15
  res <- lapply(target,function(y){
    tmp <- as.matrix(as.data.frame(x)[,y])
Jean-Marie Lepioufle's avatar
Jean-Marie Lepioufle committed
16
17
    res <- lmom::samlmu(tmp)
  })
18
19
  res <- do.call("rbind",lapply(res, function(y) as.data.frame(t(y))))
  class(res) <- c(class(res),"tbl_lmom")
Jean-Marie Lepioufle's avatar
Jean-Marie Lepioufle committed
20
21
  return(res)
}