From janko.thyson at ku-eichstaett.de  Thu Nov  4 19:12:39 2010
From: janko.thyson at ku-eichstaett.de (Janko Thyson)
Date: Thu, 4 Nov 2010 19:12:39 +0100
Subject: [Rd] Roxygen: @example tag does not work for me
In-Reply-To: <AANLkTinmQPaLiPTGY7fEg3jGE3FQRcubq9_1rjn4_va-@mail.gmail.com>
References: <5495425330153933958@unknownmsgid>
	<AANLkTinmQPaLiPTGY7fEg3jGE3FQRcubq9_1rjn4_va-@mail.gmail.com>
Message-ID: <004301cb7c4b$de0d5c00$9a281400$@thyson@ku-eichstaett.de>

> -----Urspr?ngliche Nachricht-----
> Von: h.wickham at gmail.com [mailto:h.wickham at gmail.com] Im Auftrag von
> Hadley Wickham
> Gesendet: Donnerstag, 4. November 2010 19:00
> An: Janko Thyson
> Cc: r-devel at r-project. org
> Betreff: Re: [Rd] Roxygen: @example tag does not work for me
> 
> > 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?
> 
> I would suspect that the path would be relative to either man/ or R/ -
> so you probably want ../tests/...

Thanks, I'll try that.

> But including your unit tests as examples seems like a pretty odd
> thing to do - they do serve rather different purposes.

Sure. Don't know if "unit test" is a bit of an overkill name for my stuff.
But I usually do poor man's testing of my functions in a script where I call
the function with different settings. And I thought about tagging some parts
of those scripts that qualify as good examples, have a routine that picks up
those tagged sections and writes it to, say, "/inst/examples/foo.R". I could
also create scripts that only feature good example code and use "@example
.../inst/examples/foo.R" on it. No luck with that @example in general yet,
though.

I also tried appending the example code directly to the respective
post-roxygenized .Rd-file in the man directory (write "\examples{
<example_code>}"), but that doesn't get me anywhere either. Hitting "?foo"
after the package has been build and installed does show the examples then,
but the formatting is totally wrong (i.e. no "Examples" section header but
just dumped right after the Note section etc.). I'm kinda out of clues now.

Thanks for your comments though.

Cheers,
Janko
 
> Hadley
> 
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/



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