Skip to content

Commit 6bdc390

Browse files
author
Samuel Jenness
committed
Fix print method for modfit class
Closes #1
1 parent f92ee97 commit 6bdc390

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Generated by roxygen2 (4.1.1): do not edit by hand
22

3+
S3method(print,modfit)
34
export(check_cp)
45
export(initialize_cp)
56
export(merge_simfiles)
67
export(mod_fit)
78
export(netsim_hpc)
89
export(netsim_par)
9-
export(print_modfit)
1010
export(qsub_master)
1111
export(save_cpdata)
1212
export(savesim)

R/mod_fit.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ mod_fit <- function(dir,
5757
odf$epithresh <- odf$epidiff < threshold
5858
}
5959

60+
class(odf) <- c("modfit", "data.frame")
6061
return(odf)
6162
}
6263

@@ -72,22 +73,23 @@ mod_fit <- function(dir,
7273
#' @param print.gap Spacing method passed to \code{print} method.
7374
#' @param ... Additional arguments passed to \code{print} method.
7475
#'
76+
#' @method print modfit
7577
#' @export
7678
#'
77-
print_modfit <- function(x, out = "all", print.gap = 3, ...) {
79+
print.modfit <- function(x, out = "all", print.gap = 3, ...) {
7880

7981
if (out == "all") {
80-
print(x, print.gap = print.gap)
82+
print.data.frame(x, print.gap = print.gap, ...)
8183
}
8284
if (out == "eql") {
8385
x <- x[x$thresh == TRUE, ]
8486
x <- x[order(x$reldiff), ]
85-
print(x, print.gap = print.gap)
87+
print.data.frame(x, print.gap = print.gap, ...)
8688
}
8789
if (out == "epi") {
8890
x <- x[x$thresh == TRUE & x$epithresh == TRUE, ]
8991
x <- x[order(x$epidiff), ]
90-
print(x, print.gap = print.gap)
92+
print.data.frame(x, print.gap = print.gap, ...)
9193
}
9294

9395
}

man/print_modfit.Rd renamed to man/print.modfit.Rd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
% Generated by roxygen2 (4.1.1): do not edit by hand
22
% Please edit documentation in R/mod_fit.R
3-
\name{print_modfit}
4-
\alias{print_modfit}
3+
\name{print.modfit}
4+
\alias{print.modfit}
55
\title{Printing Method for modfit Objects}
66
\usage{
7-
print_modfit(x, out = "all", print.gap = 3, ...)
7+
\method{print}{modfit}(x, out = "all", print.gap = 3, ...)
88
}
99
\arguments{
1010
\item{x}{Output object from \code{\link{mod_fit}} function.}

0 commit comments

Comments
 (0)