当前位置:网站首页>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]
- BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
- The necessity of lean production and management in sheet metal industry
- 第一章: 舍罕王失算
- Next spread
- Comments on flowable source code (37) asynchronous job processor
- Summary of learning materials and notes of Zhang Fei's actual combat electronics 1-31
- [leetcode] [SQL] notes
- Leetcode 1189. Maximum number of balloons (special character count)
- Flutter network and data storage framework construction-b1
猜你喜欢

Chapter 2: find the box array, complete number in the specified interval, and improve the complete number in the specified interval
![2022 - 06 - 30 networker Advanced (XIV) Routing Policy Matching Tool [ACL, IP prefix list] and policy tool [Filter Policy]](/img/b6/5d6b946d8001e2d73c2cadbdce72fc.png)
2022 - 06 - 30 networker Advanced (XIV) Routing Policy Matching Tool [ACL, IP prefix list] and policy tool [Filter Policy]

2022.2.14 Li Kou - daily question - single element in an ordered array

Detailed explanation of shuttle unity interworking principle

BOC protected alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC supplied by Qiyu

Free sharing | linefriends hand account inner page | horizontal grid | not for sale

Chapter 2: find the classical solution of the maximum Convention and the least common multiple of a and B, find the conventional solution of the maximum Convention and the least common multiple of a a

2022-06-30 网工进阶(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】

原生表格-滚动-合并功能

Chapter 1: find the factorial n of n!
随机推荐
Foundation of ActiveMQ
What is the content of game modeling
Pecan — Overview
These problems should be paid attention to in the production of enterprise promotional videos
Next spread
Free sharing | linefriends hand account inner page | horizontal grid | not for sale
PR 2021 quick start tutorial, how to create new projects and basic settings of preferences?
2022-07-02 advanced network engineering (XV) routing policy - route policy feature, policy based routing, MQC (modular QoS command line)
2022 - 06 - 30 networker Advanced (XIV) Routing Policy Matching Tool [ACL, IP prefix list] and policy tool [Filter Policy]
Flutter network and data storage framework construction-b1
第一章:拓广同码小数和s(d, n)
[proteus simulation] a simple encrypted electronic password lock designed with 24C04 and 1602LCD
第一章: 舍罕王失算
NFT without IPFs and completely on the chain?
[new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
Chapter 1: drinking soft drinks, step tariff calculation, step tariff calculation function, personal income tax, solving square root inequality, simplifying solving square root inequality, solving dem
Zhang Fei hardware 90 day learning notes - personal record on day 5. Please see my personal profile / homepage for the complete record
Chapter 1: find the factorial n of n!
Floating source code comment (38) parallel job processor
BOC protected phenylalanine zinc porphyrin (Zn · TAPP Phe BOC) / iron porphyrin (Fe · TAPP Phe BOC) / nickel porphyrin (Ni · TAPP Phe BOC) / manganese porphyrin (Mn · TAPP Phe BOC) Qiyue Keke