[R-pkg-devel] creating a function that creates a figure

Oliver Madsen o||ver@p@m@d@en @end|ng |rom gm@||@com
Wed Apr 28 07:20:26 CEST 2021


2 standard options are to either use an example dataset (eg. data(mtcars))
that fits your function. help(glm) has an example using the anorexia
dataset. A second option is to create toy data in the example itself. Both
help(lm) and help(glm) has examples doing so.

Br
Oliver P. M.

On Wed, 28 Apr 2021, 07:11 csmatyi, <csmatyi using protonmail.com> wrote:

> Hello all,
>
> Normally, when you write a function in R, it returns a value. That way it
> is easy to write an .Rd file for this function.
>
> However, I have written a function that does no such thing. Rather, it
> takes as input two data frames, and creates a figure. But doesn't return
> anything.
>
> In R package language, how do I write the examples in the .R file when I
> need to define the input variable first as a data frame? I can't just write
> it as
>
> add(1,2) which returns 3.
>
> Any help?
>
> Thanks so much,
> Matthew
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list