[R-pkg-devel] no source references for S4 classes?

Duncan Murdoch murdoch.duncan at gmail.com
Mon May 29 20:22:44 CEST 2017

On 29/05/2017 11:45 AM, Markus Müller wrote:
> Hi
> I am developing a small package that converts comments to documentation.
> One of my  design aims is to duplicate as little as possible of R 's
> internal machinery.
> In particular I want to load the package (to be documented) with 'library',
> inspect all its objects like functions,generics methods and classes and
> then apply my genericFunction  'writeRdFile'
> to every one of these objects.
> If possible I want to avoid parsing the package code myself.
> This works well for functions, generics, S4 methods since 'srcref'  in
> these cases yields the snippet of code that I want.
> For S4 classes it yields NULL however, while I would like to something like
> setClass(Class=MyClass,representation....
> Is there an alternative ?

Source reference information is kept for function and method bodies, but 
not for class definitions, so you'll need to do some more work to 
reconstruct the calls.  That may have been done already; hopefully if so 
someone else will point out where.

Duncan Murdoch

More information about the R-package-devel mailing list