Ioannis Vardaxis Stipendiat NTNU Sendt fra min iPhone
Videresendt melding: Fra: "bioconductorseat...@gmail.com<mailto:bioconductorseat...@gmail.com>" <bioconductorseat...@gmail.com<mailto:bioconductorseat...@gmail.com>> Dato: 26. oktober 2016 kl. 00.55.14 CEST Til: Ioannis Vardaxis <ioannis.varda...@math.ntnu.no<mailto:ioannis.varda...@math.ntnu.no>> Emne: Re: Question about a package submission On 10/25/2016 06:52 PM, Ioannis Vardaxis wrote: Hi, I have a problem documenting multiple functions in one rd file using roxygen2. I tried to find the solution on the internet with no results. I have for example 2 plot functions for class1 and class2 and I want to make a plot-method.R as the Bioconductor guideline suggests. What I have in the plot-method.R is the following code: Please ask questions about Bioconductor package development on the bioc-devel mailing list. https://stat.ethz.ch/mailman/listinfo/bioc-devel Martin #' @title Plot methods #' @author ... #' #' @references ... #' #' @description something #' @param x An x of correct class. #' @param ... something #' #' @seealso something #' #' @rdname plot # @export plot #' @include AllClasses.R #this where class1 and class2 are defined. #?#'?packages I need #' @importFrom plyr ddply . ldply laply #' @importFrom utils methods #' @importFrom S4Vectors metadata #define the plot function which is in base in R: plot <- function(x, ...){ UseMethod("plot") } #define the other plot function for my classes: #?class1 #' @rdname plot #' @method plot class1 #' @return something #' @export plot.class1=function(x,...){ code } #?class2 #' @rdname plot #' @method plot class2 #' @return something #' @export plot.class2=function(x,...){ code } When I generate with roxygen I am then able to write ??Mypkg::plot and I get nice rd files. However when I try to use plot for an x object of class1 or class2 then I get the following error: Error in as.vector(x, mode = "numeric") : no method for coercing this S4 class to a vector If on the other hand I remove the first code: plot <- function(x, ...){ UseMethod("plot") } Then I am able to run the plot functions correctly with no error, but then in the help in R I have to write ??Mypkg::plot.class1 and the main S3method is plot.class1. How can I solve this in a way that I write ??Mypkg::plot and get all the methods in one script and at the same time the plot.class1,2 work properly? Best, Ioannis [[alternative HTML version deleted]] _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel