user_roxygen
user_roxygen

Reputation: 91

R CMD roxygen not recognized

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.

Upvotes: 9

Views: 1415

Answers (4)

dardisco
dardisco

Reputation: 5274

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'.)

Upvotes: 2

user914532
user914532

Reputation: 1

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').

Upvotes: 0

Sharpie
Sharpie

Reputation: 17653

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.

Upvotes: 12

Andrew Redd
Andrew Redd

Reputation: 4692

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.

Upvotes: 2

Related Questions