Skip to content

Commit

Permalink
Fix print method for modfit class
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
Samuel Jenness committed Jun 8, 2015
1 parent f92ee97 commit 6bdc390
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Generated by roxygen2 (4.1.1): do not edit by hand

S3method(print,modfit)
export(check_cp)
export(initialize_cp)
export(merge_simfiles)
export(mod_fit)
export(netsim_hpc)
export(netsim_par)
export(print_modfit)
export(qsub_master)
export(save_cpdata)
export(savesim)
Expand Down
10 changes: 6 additions & 4 deletions R/mod_fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ mod_fit <- function(dir,
odf$epithresh <- odf$epidiff < threshold
}

class(odf) <- c("modfit", "data.frame")
return(odf)
}

Expand All @@ -72,22 +73,23 @@ mod_fit <- function(dir,
#' @param print.gap Spacing method passed to \code{print} method.
#' @param ... Additional arguments passed to \code{print} method.
#'
#' @method print modfit
#' @export
#'
print_modfit <- function(x, out = "all", print.gap = 3, ...) {
print.modfit <- function(x, out = "all", print.gap = 3, ...) {

if (out == "all") {
print(x, print.gap = print.gap)
print.data.frame(x, print.gap = print.gap, ...)
}
if (out == "eql") {
x <- x[x$thresh == TRUE, ]
x <- x[order(x$reldiff), ]
print(x, print.gap = print.gap)
print.data.frame(x, print.gap = print.gap, ...)
}
if (out == "epi") {
x <- x[x$thresh == TRUE & x$epithresh == TRUE, ]
x <- x[order(x$epidiff), ]
print(x, print.gap = print.gap)
print.data.frame(x, print.gap = print.gap, ...)
}

}
6 changes: 3 additions & 3 deletions man/print_modfit.Rd → man/print.modfit.Rd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/mod_fit.R
\name{print_modfit}
\alias{print_modfit}
\name{print.modfit}
\alias{print.modfit}
\title{Printing Method for modfit Objects}
\usage{
print_modfit(x, out = "all", print.gap = 3, ...)
\method{print}{modfit}(x, out = "all", print.gap = 3, ...)
}
\arguments{
\item{x}{Output object from \code{\link{mod_fit}} function.}
Expand Down

0 comments on commit 6bdc390

Please sign in to comment.