optunity icon indicating copy to clipboard operation
optunity copied to clipboard

Optunity R Windows

Open hseelawi opened this issue 9 years ago • 3 comments

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_.tar.gz

Would you kindly help.

hseelawi avatar Jun 07 '16 16:06 hseelawi

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 avatar Sep 17 '16 14:09 Qunal

@ Qunal how did you install it for R pls guide me step by step

mlnjsh avatar Mar 20 '19 07:03 mlnjsh

Here is what you can try: Make sure you have RTools installed on your Windows PC

  1. download the code as a zip file from here: https://github.com/claesenm/optunity.git
  2. unzip it into a local directory: C:\optunity
  3. make sure R is installed and can be reached from a command line.
  4. Open a windows CMD window with Administrator rights: C:\Windows\System32>cd\
  5. Navigate to the optunity Wrappers directory: C:>cd optunity\wrappers
  6. 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
  7. Inside the wrappers directory: C:\optunity\wrappers>R CMD build R/
  8. A compressed file should be created: optunity_1.0.tar.gz
  9. 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

`

webzest avatar Jul 03 '20 12:07 webzest