Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8799215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:16:00+00:00 2026-06-14T00:16:00+00:00

I am making a package where I want to define a new method for

  • 0

I am making a package where I want to define a new method for plot. I am using roxygen in-source documentation. This question seems very similar to:
How to properly document a S3 method of a generic from a different package, using Roxygen?
and
Roxygen2 – how to properly document S3 methods
but I still cannot get it to work.

The relevant parts that are causing me trouble are:

#' Generic plot method
#'
#' @param x \dots
#' @param ... \dots
#' @export
plot <- function(x, ...) UseMethod("plot")

#' Default plot method
#'
#' @param x \dots
#' @param ... \dots
#' @importFrom graphics plot
#' @method plot default
#' @S3method plot default
plot.default <- function(x, ...) graphics::plot(x, ...)

#' Plotting function for ABI object
#'
#' Description.
#' 
#' @param x ABI object as generated by newABI.
#' @param base Character. Bases to look at.
#' @param ... Other options passed to plot().
#' @return Nothing. Side-effect: plots graphs.
#' @method plot ABI
#' @S3method plot ABI
plot.ABI <- function(x, base, ...) {
#Overly simplified
plot(1, 1, main = base)
}

When I run this and investigate methods(plot), there is no method defined for ABI objects. Accessing the function by ABI:::plot (ABI is the name of the package) does work. Using :: does not.

During the package build check, there is a warning:

* checking S3 generic/method consistency ... WARNING
plot:
  function(x)
plot.ABI:
  function(x, base, ...)
See section ‘Generic functions and methods’ of the ‘Writing R
Extensions’ manual.

It seems that there is a disagreement in arguments. But I don’t understand this, since the generic has arguments x and … and so does my ABI method (in addition to base).

So there are two problems, which I hope stem from the same issue: The plot.ABI method is not exported and the package check throws a warning.

How do I solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:16:02+00:00Added an answer on June 14, 2026 at 12:16 am

    A few problems:

    1. Don’t include a generic that is already defined elsewhere. Just add your method.

    2. The signatures of every method must at least include every element in the generic, in the same order. It’s annoying sometimes, but it’s incontrovertible.

    Update

    I had said, “Your @export needs to list the function name,” but apparently this is not correct. See the comments. Note also that listing the method should export it. I seem to recall needing an explicit export in cases where you aren’t including the generic in your package’s namespace, but I could be wrong (so often am!).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a straightforward barchart in R using the ggplot2 package. Rather than the
This is making me very angry, I have worked on this for 2 days,
can someone point out a simple example of making a Python package using distutils
I need information about making installation packages for Linux. I want to make simple
I am making a java applet player. It includes Java.Media package, and I am
Started making a game. Here's some of my code. package games.tribe.screens; import games.tribe.model.World; import
Making a new site but something is happening to it in IE8. The social
Making a new site but something is happening to it in IE. I've purchased
I'm making my first android app and I want to to make a test
I am making my TextView clickable and want the text to change as I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.