Discussion:
[Roxygen-devel] Basic question
Marc Girondot
2012-04-05 14:27:27 UTC
Permalink
Hi "the list"

I just discover roxygen and play with it since two days.
I have been able to make my first package and it is so easy that I would
like to use it really for a project.
However, I have a problem with the production of the DESCRIPTION file.
Let two files: first HelloWorld.R

#### HelloWorld.R ####
#' showHello est une fonction R permettant d'afficher le message
#' "Hello World!" sur la console.
#' @title la fonction showHello()
#' export

showHello <-function(){
cat("Hello World!\n")
}

and

HelloWorld-package.R

#' @title The package
#' @author Marc Girondot \email{marc.girondot@@u-psud.fr}
#' @docType package
#' @name HelloWorld-package
#' @description A package
NULL

To create the package, I use:

setwd("[the path]")
package.skeleton("HelloWorld",code_files=c("HelloWorld.R",
"HelloWorld-package.R"))
library("roxygen2")
roxygenize("HelloWorld",copy.package=FALSE)
system("R CMD build '[the path]/HelloWorld'")

It works but the description file does no use the HelloWorld-package.R
information contrary to what I expected:
Package: HelloWorld
Type: Package
Title: What the package does (short line)
Version: 1.0
Date: 2012-04-05
Author: Who wrote it
Maintainer: Who to complain to <yourfault at somewhere.net>
Description: More about what it does (maybe more than one line)
License: What license is it under?
Collate:
'HelloWorld-package.R'
'HelloWorld.R'

Probably my error is stupid... please help !

Sincerely

Marc
--
__________________________________________________________
Marc Girondot, Pr

Laboratoire Ecologie, Syst?matique et Evolution
Equipe de Conservation des Populations et des Communaut?s
CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079
B?timent 362
91405 Orsay Cedex, France

Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53
e-mail: marc.girondot at u-psud.fr
Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html
Skype: girondot
Paul Johnson
2012-04-05 23:55:05 UTC
Permalink
Post by Marc Girondot
Hi "the list"
I just discover roxygen and play with it since two days.
I have been able to make my first package and it is so easy that I would
like to use it really for a project.
However, I have a problem with the production of the DESCRIPTION file.
Let two files: first HelloWorld.R
Welcome.

I've been using roxygen2 for a few months, not an expert.

I think you are missing the fact that your need a DESCRIPTION file
separate from the R code. Basically, you need all of the stuff for
building an r package, just not a separate man folder because
roxygenize will make those things.

In my case, I have never tried to do the package build from inside R
itself, but I do like you where I start R in the folder "above" the
package, say "rockchalk" is my package, I do
Post by Marc Girondot
roxygenize("rockchalk")
That builds the documentation files and futzes with the DESCRIPTION
and NAMESPACE.

After that I just exit R and run "R CMD build" and "R CMD check
rockchalk_1.xx.xx.tar.gz".

Here's how I got started with this. Get a package you like. Test that
out. My favorite lately is "lmtest". In R you can run
"download.packages("lmtest", dest="/tmp")" to grab the source. First
check you can rebuild the package following the manual in R
extensions. Then you can experiment putting in roxygen markup to see
if you can still build the package. There's a fabulous tool in the
Rd2Roxygen package. That's an awesome tool in my experience, it will
scan an existing package and convert the R program files to roxygen2.
It is the most amazing thing I've seen in quite a while.

pj
Post by Marc Girondot
#### HelloWorld.R ####
#' showHello est une fonction R permettant d'afficher le message
#' "Hello World!" sur la console.
#' export
showHello <-function(){
? ?cat("Hello World!\n")
}
and
HelloWorld-package.R
NULL
setwd("[the path]")
package.skeleton("HelloWorld",code_files=c("HelloWorld.R",
"HelloWorld-package.R"))
library("roxygen2")
roxygenize("HelloWorld",copy.package=FALSE)
system("R CMD build '[the path]/HelloWorld'")
It works but the description file does no use the HelloWorld-package.R
Package: HelloWorld
Type: Package
Title: What the package does (short line)
Version: 1.0
Date: 2012-04-05
Author: Who wrote it
Maintainer: Who to complain to <yourfault at somewhere.net>
Description: More about what it does (maybe more than one line)
License: What license is it under?
? ?'HelloWorld-package.R'
? ?'HelloWorld.R'
Probably my error is stupid... please help !
Sincerely
Marc
--
__________________________________________________________
Marc Girondot, Pr
Laboratoire Ecologie, Syst?matique et Evolution
Equipe de Conservation des Populations et des Communaut?s
CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079
B?timent 362
91405 Orsay Cedex, France
Tel: ?33 1 (0)1.69.15.72.30 ? Fax: 33 1 (0)1.69.15.73.53
e-mail: marc.girondot at u-psud.fr
Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html
Skype: girondot
_______________________________________________
Roxygen-devel mailing list
Roxygen-devel at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/roxygen-devel
--
Paul E. Johnson
Professor, Political Science ? ?Assoc. Director
1541 Lilac Lane, Room 504 ? ? Center for Research Methods
University of Kansas ? ? ? ? ? ? ? University of Kansas
http://pj.freefaculty.org ? ? ? ? ? ?http://quant.ku.edu
Loading...