【发布时间】:2019-03-06 12:08:47
【问题描述】:
我正在尝试为RJDBC::JDBCConnection 编写一个子类,因为我需要使用dplyr#2941(最初为from here)的方法来连接dbplyr 包的自定义方法。但是,我并没有覆盖*.JDBCConnection 方法,而是想为JDBCConnection 的子类编写方法。
因此,根据this Stack Overflow question 的建议,我编写了我的包,基本上是这样的:
### R/testclass.R ####################
#' Test class
#'
#' This extends JDBCConnection in package RJDBC
#'
#' @import RJDBC
#'
setClass("TestConnection", contains = "JDBCConnection")
### DESCRIPTION ######################
Package: test
Type: Package
Title: What the Package Does (Title Case)
Version: 0.1.0
Author: Who wrote it
Maintainer: The package maintainer <yourself@somewhere.net>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: What license is it under?
Encoding: UTF-8
LazyData: true
我要扩展的类已经存在,可以通过help("JDBCConnection-class", package = "RJDBC")查看。
在此包中调用 devtools::document() 会返回以下错误:
Updating test documentation Loading test Error in reconcilePropertiesAndPrototype(name, slots, prototype, superClasses, : no definition was found for superclass "JDBCConnection" in the specification of class "TestConnection"
我也试过用@importClassesFromas per this SO question替换@import,但结果是一样的。
如何让document() 运行?
【问题讨论】:
标签: r extends s4 roxygen dbplyr