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

2015-07-23 Thread Daniel Marcelino
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    
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2015-07-23 Thread Uwe Ligges



On 23.07.2015 23:21, Daniel Marcelino wrote:

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



So register it as an S3 method in your NAMESPACE file.

Best,
Uwe Ligges





#' 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  
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2015-07-23 Thread Gavin Simpson
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  wrote:

> 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
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



-- 
Gavin Simpson, PhD

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2015-07-23 Thread Daniel Marcelino
That should work then, I confused myself how to properly document S3 methods 
using Roxygen. Thanks for this. 

Daniel

> Date: Thu, 23 Jul 2015 16:41:37 -0600 
> Subject: Re: [R-pkg-devel] checking S3 generic/method consistency ... NOTE‏ 
> From: ucfa...@gmail.com 
> To: dmarcel...@live.com 
> CC: r-package-devel@r-project.org 
> 
> 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 
> mailto:dmarcel...@live.com>> wrote: 
> 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 
> __ 
> R-package-devel@r-project.org 
> mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-package-devel 
> 
> 
> 
> -- 
> Gavin Simpson, PhD 
  
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel