lmom.R 510 Bytes
Newer Older
Jean-Marie Lepioufle's avatar
Jean-Marie Lepioufle committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#' samlur

#' samlur
#' @param df tbl_friendlyts data.frame
#' @param target target in character
#' @keywords basicr
#' @export
#' @examples
#' \dontrun{
#' samlmu2()
#' }
samlmu2 <- function(df,target) {

  res <- lapply(target,function(x){
    tmp <- as.matrix(as.data.frame(df)[,x])
    res <- lmom::samlmu(tmp)
  })
  res <- dplyr::bind_cols(tibble::as_tibble(data.frame(ID=target)), dplyr::bind_rows(lapply(res, function(x) as.data.frame(t(x)))))
  class(res) <- c(class(res),"tbl_lmom") 
  return(res)
}