[R] creating a package?

R. Michael Weylandt michael.weylandt at gmail.com
Fri Apr 27 13:14:40 CEST 2012


Do you want to create a function or something like a function or a package?

Creating a function is easy:

doAThing <- function(a, b, c){
    print("The cow jumped over the moon")
    return(a + b^c)
}

Something like a function is somewhat ambiguous.

To create a package, start with the package.skeleton() function.

If it's a single function you want to distribute and it has no
compiled code or external dependencies, the package structure might be
overkill (though best practice) but you'll learn a fair bit by doing
it. If you just want to distribute a single function, you could also
put it in a text file that others could source().

Michael

On Thu, Apr 26, 2012 at 3:26 PM, Jose Bustos Melo <jbustosmelo at yahoo.es> wrote:
> Dear R users.
>
>   I'm trying to know how to create a function. I have developed a big code that use a file and makes many process and then creates a table that is exported as txt.
> The point is to make something like a function.  I need to make it easy for others, so they can run it. This has a particular name?
>
> I will be very gratefull and placed if any of you can provide some lights.
>
> Saludos,
> José Bustos
> www.aespro.cl
> Asesorias Estadisticas
> Celular 95939144
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



More information about the R-help mailing list