With roxygen2 version 6.0.1 from CRAN (published 2017-02-06), I am not able to generate meaningful .Rd files. I am on Ubuntu Linux, and I tried the following setup:
DESCRIPTION file:
Package: test
Type: Package
Title: What the Package Does (Title Case)
Version: 0.1.0
Author: Who wrote it
Maintainer: The package maintainer <[email protected]>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: What license is it under?
Encoding: UTF-8
LazyData: true
R/hello.R file:
# Hello, world!
#
# This is an example function named 'hello'
# which prints 'Hello, world!'.
#
# You can learn more about package authoring with RStudio at:
#
# http://r-pkgs.had.co.nz/
#
# Some useful keyboard shortcuts for package authoring:
#
# Build and Reload Package: 'Ctrl + Shift + B'
# Check Package: 'Ctrl + Shift + E'
# Test Package: 'Ctrl + Shift + T'
#' Test
#'
#' Test2
#' @export
hello <- function() {
print("Hello, world!")
}
When I do this:
library("roxygen2")
roxygenize()
I get a NAMESPACE file and a man/hello.Rd file with 25 bytes and the following contents:
<environment: 0x3b90500>
I guess this is not what is supposed to be in the .Rd file, right?
I downloaded roxygen2 version 5.0.1 from CRAN and tried that version instead, and now it produces the following contents instead, which looks more like what I was expecting:
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hello.R
\name{hello}
\alias{hello}
\title{Test}
\usage{
hello()
}
\description{
Test2
}
Any idea what the problem is? Thanks for any hints!
Please provide a reproducible example. This will probably involve creating a minimal package that I can download and run roxygenise() on.
The same is happening to me. I'm trying to write my very first package.
https://github.com/jcpsantiago/ISIcalc I uploaded my code here. Very basic but it should work as a reproducible example?
I'm on Arch Linux, R3.3.3, Rstudio 1.0.136, Roxygen2 6.0.1
Ideally it would be minimal - i.e. A single documented function
Something like this? I reduced it to include a single documented function.
ISIcalc_0.1.0.tar.gz
I cannot reproduce this with my setup. Can you pls send the output of devtools::session_info()?
❯ devtools::session_info()
Session info -------------------------------------------------------------------
setting value
version R version 3.3.2 (2016-10-31)
system x86_64, darwin13.4.0
ui X11
language (EN)
collate en_US.UTF-8
tz Europe/London
date 2017-03-10
Packages -----------------------------------------------------------------------
package * version date source
assertthat 0.1 2013-12-06 CRAN (R 3.3.0)
backports 1.0.5 2017-01-18 CRAN (R 3.3.2)
clisymbols 1.1.0 2017-02-07 local
commonmark 1.2 2017-03-01 CRAN (R 3.3.2)
crayon 1.3.2 2016-06-28 CRAN (R 3.3.0)
desc 1.1.0 2017-01-27 local (metacran/description@e728f18)
devtools 1.12.0 2016-06-24 CRAN (R 3.3.0)
digest 0.6.12 2017-01-27 CRAN (R 3.3.2)
gitty 1.0.0 2016-12-25 local
ISIcalc * 0.1.0 <NA> local
magrittr 1.5 2014-11-22 CRAN (R 3.3.0)
memoise 1.0.0 2016-01-29 CRAN (R 3.3.0)
memuse 3.0-1 2016-09-20 CRAN (R 3.3.0)
prettycode * 1.0.0 2017-01-27 Github (gaborcsardi/prettycode@61f51f8)
prompt 1.0.0 2016-12-25 local
R6 2.2.0 2016-10-05 CRAN (R 3.3.0)
Rcpp 0.12.9 2017-01-14 CRAN (R 3.3.2)
roxygen2 6.0.1 2017-02-06 CRAN (R 3.3.2)
rprojroot 1.2 2017-01-16 CRAN (R 3.3.2)
stringi 1.1.2 2016-10-01 CRAN (R 3.3.0)
stringr 1.2.0 2017-02-18 CRAN (R 3.3.2)
tracer * 1.0.0 2017-01-27 local (gaborcsardi/tracer@NA)
whisker 0.3-2 2013-04-28 CRAN (R 3.3.0)
withr 1.0.2 2016-06-20 CRAN (R 3.3.0)
xml2 1.1.1 2017-01-24 CRAN (R 3.3.2)
Please note the package I uploaded was built with roxygen2 5.0.1.
After updating to version 6.0.1 all my documentation files are 25B in size and contain the line posted by the OP, with some variation in the numbers.
> devtools::session_info()
Session info -----------------------------------------------------------------------------------------------
setting value
version R version 3.3.3 (2017-03-06)
system x86_64, linux-gnu
ui RStudio (1.0.136)
language (EN)
collate en_US.UTF-8
tz Europe/Luxembourg
date 2017-03-10
Packages ---------------------------------------------------------------------------------------------------
package * version date source
devtools 1.12.0 2016-06-24 CRAN (R 3.3.2)
digest 0.6.12 2017-01-27 cran (@0.6.12)
magrittr 1.5 2014-11-22 CRAN (R 3.2.2)
memoise 1.0.0 2016-01-29 CRAN (R 3.3.2)
Rcpp 0.12.9 2017-01-14 CRAN (R 3.3.2)
roxygen2 * 5.0.1 2015-11-11 CRAN (R 3.3.3)
rstudioapi 0.6 2016-06-27 CRAN (R 3.3.2)
stringi 1.1.2 2016-10-01 CRAN (R 3.3.2)
stringr 1.2.0 2017-02-18 CRAN (R 3.3.3)
withr 1.0.2 2016-06-20 CRAN (R 3.3.2)
Yes, I rebuilt it with 6.0.1 without problems using roxygen2::document(), and I don't see problems with roxygenise(), either.
I am out of guesses as to what could cause this. A few more shots in the dark:
R --vanilla from the command line? (You might need to set .libPaths() from R, if you set it to sg special.)In the meanwhile I'll try to reproduce it on Ubuntu....
I cannot reproduce it on Ubuntu, either....
Btw. can you pls send the session_info() for Roxygen 6.0.1? That is more relevant than the configuration that actually works.....
Facing the same problem. Here's a minimal package that contains all the files
https://github.com/ad1729/findBug
In particular, notice the man/hello.Rd file (https://github.com/ad1729/findBug/blob/master/man/hello.Rd)
<environment: 0x5da21d8>
The repo also contains a session_info.md file. Hope this helps!
Here's mine. Arch Linux.
I tried this on a Mac and everything worked as it should.
> devtools::session_info()
Session info -----------------------------------------------------------------------------------------------
setting value
version R version 3.3.3 (2017-03-06)
system x86_64, linux-gnu
ui RStudio (1.0.136)
language (EN)
collate en_US.UTF-8
tz Europe/Zurich
date 2017-03-13
Packages ---------------------------------------------------------------------------------------------------
package * version date source
backports 1.0.5 2017-01-18 CRAN (R 3.3.2)
commonmark 1.2 2017-03-01 CRAN (R 3.3.3)
devtools 1.12.0 2016-06-24 CRAN (R 3.3.2)
digest 0.6.12 2017-01-27 cran (@0.6.12)
evaluate 0.10 2016-10-11 CRAN (R 3.3.2)
htmltools 0.3.5 2016-03-21 CRAN (R 3.3.2)
knitr 1.15.1 2016-11-22 CRAN (R 3.3.2)
magrittr 1.5 2014-11-22 CRAN (R 3.2.2)
memoise 1.0.0 2016-01-29 CRAN (R 3.3.2)
R6 2.1.1 2015-08-19 CRAN (R 3.2.2)
Rcpp 0.12.9 2017-01-14 CRAN (R 3.3.2)
rmarkdown 1.3 2016-12-21 CRAN (R 3.3.2)
roxygen2 * 6.0.1 2017-02-06 CRAN (R 3.3.3)
rprojroot 1.2 2017-01-16 CRAN (R 3.3.2)
rstudioapi 0.6 2016-06-27 CRAN (R 3.3.2)
stringi 1.1.2 2016-10-01 CRAN (R 3.3.2)
stringr 1.2.0 2017-02-18 CRAN (R 3.3.3)
withr 1.0.2 2016-06-20 CRAN (R 3.3.2)
xml2 1.1.1 2017-01-24 CRAN (R 3.3.2)
yaml 2.1.14 2016-11-12 CRAN (R 3.3.2)
Can one of you please also try this from the terminal? Just trying to narrow it down...
Pardon the stupid question, but how do I build it from the terminal?
I tried the following: (using default settings in each case)
R CMD build findBug at the terminal and it doesn't throw any errors.
I also ran an R session in the terminal in findBug/ and used devtools::build() which also didn't lead to any errors.
Does ti automatically update the .Rd files as well? Or do I need to try devtools::document() from the R session in the terminal before building?
Pardon the stupid question, but how do I build it from the terminal?
Set the working directory to the package root, and then call devtools::document() from R.
Tried the following:
> devtools::document()
Updating findBug documentation
Loading findBug
Warning: The existing 'hello.Rd' file was not generated by roxygen2, and will not be overwritten.
Deleted the existing man/hello.Rd
> devtools::document()
Updating findBug documentation
Loading findBug
Writing hello.Rd
Which led to a new man/hello.Rd with an updated environment number <environment: 0x42964f0>
Same here after running from command line.
Can you try installing the latest version of R6?
That fixed it for me! Thanks a ton, Dr. Wickham.
PS- I'm surprised RStudio didn't show that an update to R6 was available
fixed it for me too, thanks ;)
It made me the same issue on Windows 8 with R (v3.2.2, x86_64)
Updating from R6 version 2.1.1 to 2.2.0 fixed it for me.
current installed: dplyr (0.5.0), httr (1.2.1), testhat (1.0.2)
Thanks...
I went back to test this error with roxygen v6.0.1 and various versions of R6 on a very basic package containing two functions.
R6 version 2.2.0 passes
R6 version 2.1.3 passes
R6 version 2.1.2 passes
R6 version 2.1.1 fails
i.e. roxygenize() produces the .Rd documents including only <environment: 0x0000000009b9a340> when using R6 version 2.1.1. When using R6 versions >= 2.1.2, the .Rd documents are created as desired.
I did not dig into the R6 package to see what's causing this error but it's between wch/R6@8d1827a49aad1204ba336e83df0370c1f894e4f9 and wch/R6@7295cb607085a62117098cb2bc67bb1090c05f3e
I've opened up PR #612 to hotfix the minimum R6 version to 2.1.2.
I can confirm that it works for me now with R6 v2.2.0. Thanks everybody.
Most helpful comment
Can you try installing the latest version of R6?