Skip to content

[R-pkg-devel] checking S3 generic/method consistency ... NOTE‏

4 messages · Daniel Marcelino, Uwe Ligges, Gavin Simpson

#
Hi, I would like to know how you are calming?down the?R check. I've an issue with the `head` method. I'm incorporating ?a head for data base, but nothing that I add ?in the function file seems to be able to silence the R check. Below is what I have:
?
checking S3 generic/method consistency ... NOTE
Found the following apparent S3 methods exported but not registered:
?head.SQLiteConnection


#' Return the first n elements of a SQLiteConnection object
#'
#' If a database connection is selected, returns a dataframe of table names.
#' If a table name is also supplied, the first n rows from the table are returned.
#'
#' @param x A database connection object or a table name.
#' @param \dots Additional arguments
#' @param table character specifying a table
#' @param n integer: Number of rows to output
#' @param temp logical should the function list the temp tables
#'
#' @export head.SQLiteConnection
#' @method head SQLiteConnection
#' @importFrom RSQLite dbGetQuery
#' @importFrom utils head
#' @rdname head
head.SQLiteConnection <- function(x, table = NULL, n = 10L, temp = FALSE, ...){
? if(is.null(table)){
? ? if(temp){
? ? ? RSQLite::dbGetQuery(x, "SELECT type, name, tbl_name FROM sqlite_temp_master;", ...)
? ? } else RSQLite::dbGetQuery(x, "SELECT type, name, tbl_name FROM sqlite_master;", ...)

? } else {
? ? RSQLite::dbGetQuery(x, sprintf("SELECT * FROM %s LIMIT %d;", table, n), ...)
? }
}



Daniel?
#
On 23.07.2015 23:21, Daniel Marcelino wrote:
So register it as an S3 method in your NAMESPACE file.

Best,
Uwe Ligges
#
Hi Daniel

You should only neee

#' @export

in your roxygen markup as roxygen (well recent versions anyway) are able to
do the right thing and work out what needs to go into the NAMESPACE file.
You don't need @method now, except in cases where there is ambiguity about
the method/class, which shouldn;t be the case here.

See: http://r-pkgs.had.co.nz/namespace.html#exports

HTH

G
On 23 July 2015 at 15:21, Daniel Marcelino <dmarcelino at live.com> wrote:

            

  
    
#
That should work then, I confused myself how to properly document S3 methods using Roxygen. Thanks for this.?

Daniel
________________________________