R/coef.R

Defines functions coef.linreg

Documented in coef.linreg

#' Coef method for linreg objects
#' 
#' @description Extract coefficients from an object of the class "linreg".
#' @param object An object of class "linreg", generated by a call to \code{\link{linreg}}.
#' @param ... additional arguments.
#' @return A vector of coefficients.
#' @examples 
#' linreg_obj <- linreg(Petal.Length~Species, datasets::iris)
#' coef(linreg_obj)
#' @export
  

coef.linreg <- function(object,...){
  coefs <- as.vector(object$beta_hat)
  names(coefs) <- row.names(object$beta_hat)
  return(coefs)
}
hugkn566/Lab4HugoOtto documentation built on Oct. 20, 2020, 2:17 p.m.