[R] Example for Roxygen @eval tag?
bor|@@@te|pe @end|ng |rom utoronto@c@
Mon Apr 22 08:40:39 CEST 2019
I see .. you mean code that extends Roxygen. I was thinking something simple like an .Rmd chunk. But just creating an existing tag doesn't do much either:
#' @eval sprintf("@section Time: %s", Sys.time() )
@eval sprintf("@section Time:
... in the .Rd - more than before, but not what I thought.
An actual example would be most enlightening.
> On 2019-04-22, at 02:25, Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
> What tag are you creating with the eval? Your example wouldn't create valid roxygen code... as I said, it looks rather meta....
> On April 21, 2019 10:40:27 PM PDT, Boris Steipe <boris.steipe using utoronto.ca> wrote:
>> Yes, that's where I started - the vignette says:
>> ... Run arbtirary R code with @eval.
>> ... the @eval tag. It evaluates code and treats the result as if it
>> was a literal roxygen tags. This makes it possible to eliminate
>> duplication by writing functions.
>> The first thing I noticed was that it does not say anything about
>> delimiters. By trial and error it seems to consider everything up to
>> the next @... tag in the header. Things that are not R code create an
>> error during devtools::document() processing. It seems the output is
>> captured and processed, i.e. System.time() creates a not-a-string
>> error, but as.character(System.time()) passes ... but then nothing
>> appears in the .Rd - and I haven't been able to find a single example
>> of @eval in use in the wild.
>> No joy.
>>> On 2019-04-22, at 01:29, Jeff Newmiller <jdnewmil using dcn.davis.ca.us>
>>> I have not used it... but did you read the vignette ? It sounds
>> like it is a bit more meta than you think it is...
>>> On April 21, 2019 7:44:17 PM PDT, Boris Steipe
>> <boris.steipe using utoronto.ca> wrote:
>>>> Playing with Roxygen features, but can't get @eval to work. E.g. ...
>>>> #' @eval sprintf("%s", Sys.time())
>>>> ... does not do what I thought it would (i.e. substitute the tag and
>>>> the expression with the string). Instead I see nothing in the .RD
>>>> Any working examples out there?
>>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> PLEASE do read the posting guide
>>>> and provide commented, minimal, self-contained, reproducible code.
>>> Sent from my phone. Please excuse my brevity.
> Sent from my phone. Please excuse my brevity.
More information about the R-help