当前位置:网站首页>Rd file name conflict when extending a S4 method of some other package
Rd file name conflict when extending a S4 method of some other package
2022-07-03 19:30:00 【javail】
problem :
Actual question Practical problems
How do I avoid Rd file name conflicts when How to avoid Rd Filename conflict
- a S4 generic and its method(s) are not necessarily all defined in the same package (package containing (some of) the custom method(s) depends on the package containing the generic) and One S4 General and its methods ( One or more ) No need Are defined in the same package ( contain ( Part of the ) Custom method ( One or more ) The software package depends on including the general package ), and
- using
roxygenize()from package roxygen2 to generate the actual Rd files? Use the bag roxygen2 Mediumroxygenize()To generate the actual Rd file ?
I'm not sure if this is a roxygen2 problem or a common problem when the generic and its method(s) are scattered across packages (which IMHO in general definitely is a realistic use-case scenario if you follow a modular programming style). I'm not sure this is a roxygen2 The problem is also a common problem , When generics and their methods are scattered in packages ( If you follow the modular programming style , With all due respect, it must be a real use case scenario ).
What's the recommended way to handle these situations? What is the recommended way to deal with these situations ?
Illustration illustrations
In package pkga In the bag pkga
Suppose in package pkga you defined a generic method foo and that you've provided the respective roxygen code that roxygenize() picks up to generate the Rd file: Suppose in the package pkga You have defined a general method foo , You have provided roxygenize() Select the corresponding roxygen Code to generate Rd file :
#' Test function#' #' Test function.#' #' @param ... Further arguments.#' @author Janko Thyson \email{[email protected]@rappster.de}#' @example inst/examples/foo.R#' @docType methods#' @rdname foo-methods#' @exportsetGeneric( name="foo", signature=c("x"), def=function( x, ... ) { standardGeneric("xFoo") })When roxygenizing() your package, a file called foo-methods.Rd is created in the man subdirectory that serves as the reference Rd file for all methods that might be created for this generic method. When roxygenizing() Packet time , Will be in man Create a subdirectory named foo-methods.Rd The file of , This file serves as a reference to all methods that may be created for this generic method Rd file .So far so good. So far so good .If all of the methods for this generic are also part of your package, everything's good. If all the common methods are also part of your package , Everything is fine .For example, this roxygen code would make sure that documentation is added to foo-methods.Rd for the ANY -method of foo : for example , this roxygen The code will ensure that the file is added to foo-methods.Rd by ANY Of - Method foo :
#' @param x \code{ANY}.#' @return \code{TRUE}.#' @rdname foo-methods#' @aliases foo,ANY-method#' @exportsetMethod( f="foo", signature=signature(x="ANY"), definition=cmpfun(function( x, ... ) { return(TRUE) }, options=list(suppressAll=TRUE)))However, if package pkga provides the generic for foo and you decide in some other package (say pkgb ) to add a foo -method for x being of class character , then R CMD check will tell you that there is a name clash with respect to Rd file names and/or aliases (as there already exists a Rd file foo-methods.Rd in pkga ): however , If the bag pkga by foo Provides universal , And you decide on other packages ( such as pkgb ) In Chinese, it means x For the class character add to foo -method, that R CMD check Will tell you that there is a name conflict related to it Rd File name and / Or alias ( Because in pkga Already exists Rd file foo-methods.Rd ):
In package pkgb In the bag pkgb
#' @param x \code{character}.#' @return \code{character}.#' @rdname foo-methods#' @aliases foo,character-method#' @exportsetMethod( f="foo", signature=signature(x="character"), definition=cmpfun(function( x, ... ) { return(x) }, options=list(suppressAll=TRUE)))To be more precise, this is the error that's thrown/written to file 00install.out To be more exact , This is a throw / write file 00install.out
Error : Q:/pkgb/man/foo-methods.Rd: Sections \title, and \name must exist and be unique in Rd filesERROR: installing Rd objects failed for package 'pkgb'Due dilligence responsible investigation
I tried to change the values for @rdname and @aliases to foo_pkgb* (instead of foo* ), but \\title and \\name still are set to foo when roxygenizing and thus the error remains. I tried to put @rdname and @aliases The value of is changed to foo_pkgb* ( instead of foo* ), But when roxygenizing when , \\title and \\name Still set to foo , So mistakes still exist stay .Any ideas besides manually editing the Rd files generated by roxygenize() ? Except for manual editing roxygenize() Generate Of Rd Outside the file Any idea ?
EDIT 2012-12-01 edit 2012-12-01
In light of starting the bounty, the actual question might get a slightly broader flavor: Start with the bounty , Practical problems may become broader :
How can we implement some sort of an "inter-package" check with respect to Rd files and/or how can we consolidate S4 method help files scattered across packages into one single Rd file in order to present a single source of reference to the end-user? How do we target Rd Files implement some kind of “ Private Room ” Check and / Or how we can distribute the S4 Method help files are merged into a single Rd In file , To provide a single reference source for the end - user ?
Solution :
Reference resources : https://stackoom.com/en/question/t7lo边栏推荐
- 2022 - 06 - 30 networker Advanced (XIV) Routing Policy Matching Tool [ACL, IP prefix list] and policy tool [Filter Policy]
- Chapter 1: find all factorial sums, Grand Prix site unified programming, three factorial sums, graphic point scanning, recursive factorial n of n!, Find the factorial n of n!, King Shehan miscalculate
- BOC protected amino acid porphyrins TAPP ala BOC, TAPP Phe BOC, TAPP Trp BOC, Zn · TAPP ala BOC, Zn · TAPP Phe BOC, Zn · TAPP Trp BOC Qiyue
- 2022-06-28 advanced network engineering (XIII) IS-IS route filtering, route summary, authentication, factors affecting the establishment of Isis neighbor relations, other commands and characteristics
- Difference between surface go1 and surface GO2 (non professional comparison)
- [optics] vortex generation based on MATLAB [including Matlab source code 1927]
- IPv6 experiment
- Chapter 1: extend the same code decimal sum s (D, n)
- Go home early today
- Record the errors reported when running fluent in the simulator
猜你喜欢

Merge K ascending linked lists

CMD implements the language conversion of locale non Unicode programs

During MySQL installation, the download interface is empty, and the components to be downloaded are not displayed. MySQL installer 8.0.28.0 download interface is empty solution

Recommend a GIF processing artifact less than 300K - gifsicle (free download)

2022-07-02 advanced network engineering (XV) routing policy - route policy feature, policy based routing, MQC (modular QoS command line)

We have built an intelligent retail settlement platform

Common text labels

PR 2021 quick start tutorial, how to create new projects and basic settings of preferences?

03 -- QT OpenGL EBO draw triangle

Chapter 1: find all factorial sums, Grand Prix site unified programming, three factorial sums, graphic point scanning, recursive factorial n of n!, Find the factorial n of n!, King Shehan miscalculate
随机推荐
Pecan — Overview
We have built an intelligent retail settlement platform
原生表格-滚动-合并功能
2022.2.14 Li Kou - daily question - single element in an ordered array
[proteus simulation] a simple encrypted electronic password lock designed with 24C04 and 1602LCD
Chapter 1: find all factorial sums, Grand Prix site unified programming, three factorial sums, graphic point scanning, recursive factorial n of n!, Find the factorial n of n!, King Shehan miscalculate
Read the paper glodyne global topology preserving dynamic network embedding
第二章:4位卡普雷卡数,搜索偶数位卡普雷卡数,搜索n位2段和平方数,m位不含0的巧妙平方数,指定数字组成没有重复数字的7位平方数,求指定区间内的勾股数组,求指定区间内的倒立勾股数组
第一章: 舍罕王失算
2022-06-30 網工進階(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu
Summary of learning materials and notes of Zhang Fei's actual combat electronics 1-31
Xctf attack and defense world crypto master advanced area olddriver
Free hand account sharing in September - [cream Nebula]
PR FAQ: how to set PR vertical screen sequence?
Web Security (VII) specific process of authentication with session cookie scheme
Leetcode 1189. Maximum number of balloons (special character count)
Merge K ascending linked lists
[wallpaper] (commercially available) 70 wallpaper HD free
Octopus online ecological chain tour Atocha protocol received near grant worth $50000