[R] Example for Roxygen @eval tag?

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Mon Apr 22 08:25:30 CEST 2019


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>
>wrote:
>> 
>> I have not used it... but did you read the vignette [1]? It sounds
>like it is a bit more meta than you think it is...
>> 
>> [1]
>https://cran.r-project.org/web/packages/roxygen2/vignettes/rd.html
>> 
>> 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
>file.
>>> 
>>> Any working examples out there?
>>> Thanks!
>>> Boris
>>> 
>>> ______________________________________________
>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> 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 mailing list