Create package on Windows

Asked

Viewed 109 times

3

Given a set of functions, like creating a package on Windows OS?

For example for the two functions below:

soma = function(x, y){
res = x + y
res
}

multiplica = function(x,y){
res = x*y
res
}
  • You use an R? editor like Rgui?

  • I use only Rstudio.

1 answer

2


On Rstudio, click on Project > New Project

inserir a descrição da imagem aqui

Then click on New Directory

inserir a descrição da imagem aqui

Then click on R Package

inserir a descrição da imagem aqui

Name the package. It cannot contain spaces nor - in addition to other rules.

inserir a descrição da imagem aqui

Rstudio will open a standard project with the following files:

  • DESCRIPTION
  • man/
  • NAMESPACE
  • R/

Enter folder R and create how many files .R you want with your functions.

Click on Build & Reload. Ready the package has been created.

inserir a descrição da imagem aqui

Of course packages can be much more complicated than that. I recommend reading of this link which is a brief introduction. But surely the best reference is the hadley’s book. @Juliotrecenti gave a presentation about creating packages which is also on youtube.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.