Skip to content

roxygen2 v6.0.0

4 messages · Marc Girondot, Yihui Xie, Bert Gunter

#
Hi,

I used roxygen2 v5.0.1 to document my package, and all was ok. I have 
just updated to roxygen2 v6.0.0 and my script is broken and I can't find 
why.

I have done a simple version of a package folder as a test with 3 files: 
chr.R, essai-package.R and DESCRIPTION.

Previously, I did:

package.skeleton("essai",code_files=c('chr.R',"essai-package.R"))
roxygenize("essai")
system(paste0("R CMD build '", getwd(), "/essai'"))
install.packages(file.path(getwd(), "essai_1.0.tar.gz"), repos = NULL, 
type="source")

And it worked well.

Now I get an error at the second line: roxygenize("essai")

 > roxygenize("essai")
First time using roxygen2. Upgrading automatically...
Updating roxygen version in 
/Users/marcgirondot/Documents/Espace_de_travail_R/Package_Essai/essai/DESCRIPTION
Warning: The existing 'NAMESPACE' file was not generated by roxygen2, 
and will not be overwritten.
Warning: The existing 'chr.Rd' file was not generated by roxygen2, and 
will not be overwritten.
Warning: The existing 'essai-package.Rd' file was not generated by 
roxygen2, and will not be overwritten.

And of course it fails after.

Are you aware of this situation ? And do you have a solution ?

Thanks a lot

Marc


A file DESCRIPTION:

Package: essai
Type: Package
Title: Package Used For Try
Version: 1.0
Date: 2017-02-06
Author: Marc Girondot <marc.girondot at u-psud.fr>
Maintainer: Marc Girondot <marc.girondot at u-psud.fr>
Description: Trying package.
Depends: R (>= 2.14.2)
License: GPL-2
LazyData: yes
LazyLoad: yes
Encoding: UTF-8
RoxygenNote: 6.0.0

A file essai-package.R (essai=try in French):

#' Trying package
#'
#' \tabular{ll}{
#'  Package: \tab essai\cr
#'  Type: \tab Package\cr
#'  Version: \tab 1.0 - build 1\cr
#'  Date: \tab 2017-02-06\cr
#'  License: \tab GPL (>= 2)\cr
#'  LazyLoad: \tab yes\cr
#'  }
#' @title The package essai
#' @author Marc Girondot \email{marc.girondot@@u-psud.fr}
#' @docType package
#' @name essai-package

NULL

A file chr.R:

#' chr returns the characters defined by the codes
#' @title Return the characters defined by the codes
#' @author Based on this blog: 
http://datadebrief.blogspot.com/2011/03/ascii-code-table-in-r.html
#' @return A string with characters defined by the codes
#' @param n The vector with codes
#' @description Return a string with characters defined by the codes. 
J'essaye avec un code utf-8: ?.
#' @examples
#' chr(65:75)
#' chr(unlist(tapply(144:175, 144:175, function(x) {c(208, x)})))
#' @encoding UTF-8
#' @export


chr <- function(n) {
     rawToChar(as.raw(n))
     }
#
If your package source is version controlled (meaning you are free to
regret any time), I'd recommend you to delete the three files
NAMESPACE, chr.Rd, and essai-package.Rd. Then try to roxygenize again.
Basically the warnings you saw indicates that roxygen2 failed to find
the line

% Generated by roxygen2: do not edit by hand

in your NAMESPACE and .Rd files, so it thinks these files were
probably not previously generated by roxygen2. I think the cause is
package.skeleton(), which generated the Rd files. Seriously, friends
don't let friends use package.skeleton()... (it is 2017 now)

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Web: http://yihui.name


On Mon, Feb 6, 2017 at 9:46 AM, Marc Girondot via R-help
<r-help at r-project.org> wrote:
#
Le 06/02/2017 ? 17:14, Yihui Xie a ?crit :
Thanks ! It works perfectly after removing the /man/ folder and the 
NAMESPACE file.
I didn't know that package.skeleton() was out-of-age !
That's true that it is easy to generate the skeleton manually.

Marc
#
Marc:

You miss Yihui's point I think: roxygen2 will generate the (Namespace
and other) files for you. See its documentation for how (the
directives to put in your comments).

-- Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Feb 6, 2017 at 9:38 AM, Marc Girondot via R-help
<r-help at r-project.org> wrote: