当前位置:网站首页>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边栏推荐
- 05 -- QT OpenGL draw cube uniform
- QT -- qfile file read / write operation
- [free sharing] kotalog diary2022 plan electronic manual ledger
- 第二章:求长方体数组,指定区间内的完全数,改进指定区间内的完全数
- PR 2021 quick start tutorial, material import and management
- 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
- Xctf attack and defense world crypto advanced area best_ rsa
- Why should we do feature normalization / standardization?
- Leetcode 1189. Maximum number of balloons (special character count)
- Php based campus lost and found platform (automatic matching push)
猜你喜欢
Recommend a GIF processing artifact less than 300K - gifsicle (free download)
Flume learning notes
IPv6 experiment
2022-06-27 advanced network engineering (XII) IS-IS overhead type, overhead calculation, LSP processing mechanism, route revocation, route penetration
Using the visualization results, click to appear the corresponding sentence
The necessity of lean production and management in sheet metal industry
2022-06-25 advanced network engineering (XI) IS-IS synchronization process of three tables (neighbor table, routing table, link state database table), LSP, cSNP, psnp, LSP
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
Chapter 1: seek common? Decimal and S (D, n)
[optics] vortex generation based on MATLAB [including Matlab source code 1927]
随机推荐
Today I am filled with emotion
Chapter 1: extend the same code decimal sum s (D, n)
Flume learning notes
第二章:基于分解的求水仙花数,基于组合的求水仙花数, 兰德尔数,求[x,y]内的守形数,探求n位守形数,递推探索n位逐位整除数
Summary of 90 day learning materials and notes of Zhang Fei's actual electronic hardware engineer
Php based campus lost and found platform (automatic matching push)
Analysis of dart JSON encoder and decoder
The necessity of lean production and management in sheet metal industry
BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
The most valuable thing
Day_ 18 IO stream system
Strict data sheet of new features of SQLite 3.37.0
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
Zhang Fei hardware 90 day learning notes - personal record on day 6. Please see my personal profile / homepage for the complete record
Chapter 1: simplify the same code decimal sum s (D, n)
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
Ego planner code parsing Bspline_ Optimizer section (2)
Free hand account sharing in September - [cream Nebula]
Octopus online ecological chain tour Atocha protocol received near grant worth $50000
Latex image rotates with title