R/print.R

Defines functions print.linreg

Documented in print.linreg

#' Print out the estimated coeffiencts 
#' 
#' @description Estimated coeffiencts from an x of class "linreg".
#' @param x An object of Class "linreg", generated by a call to \code{\link{linreg}}.
#' @param ... additional arguments.
#' @return A list of estimated coeffiencts.
#' @examples 
#' linreg_obj <- linreg(Petal.Length~Species, datasets::iris)
#' print(linreg_obj)
#' @export

print.linreg <- function(x,...) {
  colnames(x$beta_hat) <- ""
  
  cat("Call:", sep="\n")
  cat("linreg(formula = ", x$y_name, " ", "~", " ", x$x_names, ", ","data = ", x$data_name, ")", sep = "")
  cat(" ", sep = "\n")
  cat("Coefficients:", sep="\n")
  print(as.matrix(t(x$beta_hat)))
}
hugkn566/Lab4HugoOtto documentation built on Oct. 20, 2020, 2:17 p.m.