Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R CMD roxygen not recognized

Tags:

r

roxygen

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.

like image 747
user_roxygen Avatar asked Dec 08 '10 15:12

user_roxygen


3 Answers

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.

like image 128
Sharpie Avatar answered Nov 15 '22 19:11

Sharpie


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.

like image 24
Andrew Redd Avatar answered Nov 15 '22 19:11

Andrew Redd


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

like image 28
dardisco Avatar answered Nov 15 '22 19:11

dardisco