Possible roxygen2 4.0.0 bug?

261 views
Skip to first unread message

Eduardo Ibanez

unread,
May 8, 2014, 2:39:09 PM5/8/14
to rdev...@googlegroups.com
Hello,

I think I found a bug in the latest version of roxygen2 (4.0.0). I'm running R 3.1.0 on Windows.

I'm writing a package that uses figures in the documentation and I do so by following the answer in http://stackoverflow.com/a/7953949. That answer points to http://cran.r-project.org/doc/manuals/R-exts.html#Figures that says "http://cran.r-project.org/doc/manuals/R-exts.html#Figures".

If you create that folder, the new version of roxygen2 tries to access and modify the folder as a file and throws an error. For example,

> upgradeRoxygen()
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : cannot open file './man/figures': Permission denied

It looks like folders should be excluded from roxygen functions, if this is really a bug.

Alternatively, is there a preferable way to include images?

Thanks in advance,
Eduardo

Hadley Wickham

unread,
May 8, 2014, 2:50:19 PM5/8/14
to Eduardo Ibanez, rdev...@googlegroups.com
Hi Eduardo,

upgradeRoxygen() has been done away with in the latest dev version, so
this should no longer be a problem. (upgrades now happen automatically
because I figured out a safer way to do it)

Hadley
> --
> You received this message because you are subscribed to the Google Groups
> "devtools" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rdevtools+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
http://had.co.nz/

Eduardo Ibanez

unread,
May 8, 2014, 3:02:49 PM5/8/14
to rdev...@googlegroups.com, Eduardo Ibanez
Hadley,

Thanks for the fast response. The problem is not limited to upgradeRoxygen(). I find the same error message when running devtools::document()

To reproduce this error, I downloaded the trunk version of ggplot2 (https://github.com/hadley/ggplot2/archive/master.zip), loaded devtools and run

> document()
Updating ggplot2 documentation
Loading ggplot2
Writing label_wrap_gen.Rd
Writing labeller.Rd


Next, I added the (empty) folder "man/figures" and document() does not work anymore:

> document()
Updating ggplot2 documentation
Loading ggplot2
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:\Users\eibanez\Documents\Rdevelop\ggplot2-master/man/figures': Permission denied


Would this be fixed in the dev version of roxygen2?

Thanks,
Eduardo

Hadley Wickham

unread,
May 9, 2014, 1:39:18 PM5/9/14
to Eduardo Ibanez, rdev...@googlegroups.com
It seems to be - I couldn't recreate the error.

Hadley

Eduardo Ibanez

unread,
May 14, 2014, 10:11:24 AM5/14/14
to rdev...@googlegroups.com, Eduardo Ibanez
Mmm, it might be a Windows-only error. The development version does not work either.

I found that the error originates in the first line of "first_time" (https://github.com/klutometis/roxygen/blob/master/R/safety.R#L2). The dir() function will return a list of both files and directories (at least in Windows), as shown below in item number 4:

> dir("man", full.names = TRUE)
[1] "man/calculate_elcc.Rd"    "man/calculate_metrics.Rd" "man/capacity_value.Rd"   
[4] "man/figures"              "man/format_timedata.Rd"   "man/outage_table.Rd"     
[7] "man/repra.Rd"             "man/sliding_window.Rd" 

I am sending a pull request with the following lines that takes folders out of generated. An alternative would be to use a filter in dir().
generated <- generated[file.info(generated)$isdir]

Thanks,
Eduardo

Remko Duursma

unread,
Jun 11, 2014, 11:52:50 PM6/11/14
to rdev...@googlegroups.com, edu.i...@gmail.com
The error still persists (I had posted this to http://stackoverflow.com/questions/23797391/roxygen2-4-0-1-fails-when-man-figures-is-present)

I have tried dev version 4.0.1.99
Reply all
Reply to author
Forward
0 new messages