R CMD roxygen not recognized
Asked Answered
I

4

9

I just tried out Roxygen package. Within R, I can run through the example in the Roxygen Vignette. But In command line, R CMD roxygen is not recognized as a valid command. When I run R CMD --help, I can see all INSTALL, check, ...sweave..., config... command items but not roxygen. can anyone help me out of this? is there addtional installation steps required other than install.packages("roxygen")? I use windows 32 with R 2.12.0 and working Rtools environments. Thanks.

Immoderation answered 8/12, 2010 at 15:15 Comment(1)
I am on windows, too, but I use the cygwin Bash shell. If I run R CMD roxygen.sh (note, the .sh), it works. However, it does not work, if I use the Windows command line (of course not, it's a shell script...).Coheir
S
12

If I recall, you have to install packages from source in order for them to be able to provide additional commands for R CMD. This is because installing new R CMD commands is a bit of a hack---it requires hijacking the configure script or Makefile and having them copy files to the R bin folder. Installing a package from binary simply unpacks an archive, configure and make are never run.

So try install.packages('roxygen', type='source'). On Windows you will need to install the RTools before this will work.

Sacred answered 8/12, 2010 at 21:18 Comment(1)
thanks. had the same problem. installing from source as administrator did it.Carryingon
C
2

I just ran into this the other day. I installed as administrator and that fixed it. Just run R as Administrator then do install.packages as normal, then restart R since you don't really want to run it as administrator.

Causey answered 8/12, 2010 at 16:17 Comment(2)
Just did a fresh install and that didn't seem to do the trick, sorry, not quite sure what I did to get it to work then.Causey
I had that problem in Ubuntu and had to 'sudo R' then install the package.Incommodious
L
2

This is a workaround that I have found to be useful working with roxygen2 from the command line (DOS) in Windows. Much of the material is borrowed from here.

Create file roxy.R with contents:

library(methods)
library(utils)
require(roxygen2)
roxygenize("myPackage")

(Or whatever arguments you're using with roxygen).

Then create batch file f.bat with contents:

Rscript roxy.R

Then run f from the command line:

> f

Notes:

Make sure Rscript.exe is in your path. It's usually found somewhere like c:\r:\bin\

(To edit the path in Windows, right click 'My Computer', then select 'Properties' then 'Advanced system settings' (on left menu) then 'Advanced' tab, 'Environment Variables' button, 'System variables', 'Path'.)

Lilli answered 27/3, 2013 at 21:17 Comment(0)
O
0

I tested on windows. R CMD %R_home%\bin\roxygen.sh works. but neither R CMD roxygen.sh nor R CMD roxygen works under DOS command. Although .sh has been associated to sh.exe and %R_home%\bin\ is on system path. Same for installing by source with R CMD INSTALL or install.packages(type='source').

Obtrude answered 8/12, 2010 at 21:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.