Optunity R Windows
I have been trying to install optunity for R on my Windows 10 pc, but am not sure I understand the instruction found in the library documentation. To be more specific, I tried typing the two command lines below in git bash and the command prompt, but they both return an error message that "R" is not a recognizable command.
R CMD build R/
R CMD INSTALL optunity_
Would you kindly help.
I just installed with R. This is a path and potentially a binary problem. Rcmd.exe is in C:\Program Files\R\version\bin. Set that in your system path
On Windows to build R packages you need Rtools and relevant compiler. Google and install Rtools first
@ Qunal how did you install it for R pls guide me step by step
Here is what you can try: Make sure you have RTools installed on your Windows PC
- download the code as a zip file from here: https://github.com/claesenm/optunity.git
- unzip it into a local directory: C:\optunity
- make sure R is installed and can be reached from a command line.
- Open a windows CMD window with Administrator rights: C:\Windows\System32>cd\
- Navigate to the optunity Wrappers directory: C:>cd optunity\wrappers
- Inside the wrappers directory, check that R is accessible: C:\optunity\wrappers>R if you get an error, then you are not ready and you need to add R to your PATH
- Inside the wrappers directory: C:\optunity\wrappers>R CMD build R/
- A compressed file should be created: optunity_1.0.tar.gz
- Open R and install the following libraries: install.packages(c("rjson", "ROCR", "enrichvs", "plyr")) 10 . Then, install the gz optunity file file with the Tools installer and point it to the gz file.
I was able to get the file to install, but was not able to run Code successfully with optunity. For example, this piece of code from the help file failed on my PC, after having a successful installation:
`
library(optunity) f <- function(x,y) -xx - 0.5y*y opt <- particle_swarm(f, x=c(-5, 5), y=c(-5, 5) ) Error in if (is.na(port) || port == 0) { : missing value where TRUE/FALSE needed
`