smach,
@smach@masto.machlis.com avatar

The {document} 📦 creates roxygen2-style documentation for functions that aren't (yet) part of an R package.

In the screenshot below, top left shows a test.R file with a function called test_function , including roxygen definitions. After running

d <- document("test.R")

I can use

?test_function

to read the help file as if it were part of a package.

By Andreas Dominik Cullmann

https://cran.r-project.org/web/packages/document/vignettes/Introduction_to_document.html

@rstats

kamapu,
@kamapu@social.cologne avatar

@smach @rstats It is useful to promote documenting functions even before including them in a package, to explain properly functions exchanged in scripts and perhaps to produce documentation of "internal functions" in packages.

kamapu,
@kamapu@social.cologne avatar
jromanowska,
@jromanowska@fosstodon.org avatar

@smach @rstats what's the difference between this one and {docstring}? https://github.com/dasonk/docstring

smach,
@smach@masto.machlis.com avatar

@jromanowska @rstats {document} will generate a PDF; as far as I know, {docstring} doesn't.
Also, the CRAN version of docstring hasn't been updated since 2017, and some people prefer code that's a bit more recent given the many changes in the R ecosphere in the last 6 years. But docstring is likely a fine option too. One thing about R - many choices!

ERDonnachie,

@smach @rstats
That could be useful, thanks.

What does the assignment to d actually do? That's intriguing...

  • All
  • Subscribed
  • Moderated
  • Favorites
  • rstats@a.gup.pe
  • anitta
  • DreamBathrooms
  • osvaldo12
  • mdbf
  • everett
  • magazineikmin
  • khanakhh
  • Youngstown
  • rosin
  • slotface
  • modclub
  • kavyap
  • tacticalgear
  • ngwrru68w68
  • JUstTest
  • thenastyranch
  • cisconetworking
  • Durango
  • ethstaker
  • InstantRegret
  • Leos
  • provamag3
  • GTA5RPClips
  • tester
  • cubers
  • megavids
  • normalnudes
  • lostlight
  • All magazines