Re: [Rd] Roxygen: @example tag does not work for me

From: Janko Thyson <janko.thyson_at_ku-eichstaett.de>
Date: Thu, 04 Nov 2010 11:03:54 +0100

> -----Ursprüngliche Nachricht-----
> Von: baptiste auguie [mailto:baptiste.auguie_at_googlemail.com]
> Gesendet: Donnerstag, 4. November 2010 07:43
> An: Janko Thyson
> Cc: r-devel_at_r-project. org
> Betreff: Re: [Rd] Roxygen: @example tag does not work for me
>
> Hi,
>
> I think you could achieve this using the brew package. Define a
> function that reads your external example file, and have brew insert
> the resulting string in your script, which can then be processed by
> roxygen.
>
> I'm curious to hear other suggestions, but I doubt it could work
> out-of-the-box like you intended.
>
> HTH,
>
> baptiste

Thanks a lot for the suggestion, I will have a look at brew. But I still think that "@example" is meant to do what I'm trying to do out-of-the box. At least it says so in the Roxygen manual (p. 19) and I found such a Roxygen line in the tutorial given at user! 2010 (http://roxygen.org/useR/roxygen-part-1.pdf, p. 25). Did anyone of you use "@example" yet?

Cheers,
Janko

>
> On 4 November 2010 01:50, Janko Thyson <janko.thyson@ku-eichstaett.de>
> wrote:
> > Dear list,
> >
> >
> >
> > somehow I can't get the Roxygen tag "@example" to work for me.
> >
> >
> >
> > My "Roxygen-Header" of a script containing, say, a function looks
> like this:
> >
> >
> >
> > #' My header
> >
> > #'
> >
> > #' My description
> >
> > #'
> >
> > #' @param a Blabla.
> >
> > #' @param b Blabla.
> >
> > #' @return \code{TRUE}.
> >
> > #' @callGraphPrimitives
> >
> > #' @references
> >
> > #' \url{http://www.something.org /}
> >
> > #' @author Janko Thyson \email{my.email@@something.com}
> >
> > #' @example tests/foo.R
> >
> > #' @seealso \code{\link{some.other.function}}
> >
> > Foo <- function(a, b){cat("Doing nothing useful.")}
> >
> >
> >
> > I thought that @example would take the R code in "tests/foo.R" (this
> file

> > also exists) and append it to the .Rd-file. However, there is no
> > \examples{...} section in my roxygen-processed .Rd-file after running

> > roxygenize(). It just seems as if @example is just neglected. Should
> I put
> > the file in another directory?
> >
> >
> >
> > The basic thing I'm trying to do is to have the "unit tests" for my
> > functions organized in separate scripts and then plug in some of
> their
> > content as examples in the .Rd-files (this should be accomplished by
> using
> > in-source documentation ŕ la Roxygen ŕ thus something like "@example"
> > pointing to such a script file would be very neat). I'd definitely
> like to
> > get around to "manually" specifying examples via the other tag
> "@examples"
> > as they will most likely lead to "out-of-sync" situations regarding
> the unit
> > test files. Any ideas?
> >
> >
> >
> > Thanks a lot!
> >
> > Janko
> >
> >
> >
> >
> > ______________________________________________
> > R-devel_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> >



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 04 Nov 2010 - 10:07:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 04 Nov 2010 - 13:20:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive