4

I am trying to use the package Ryacas in R. Here what is going on:

> install.packages("Ryacas")
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://www.stats.bris.ac.uk/R/bin/windows/contrib/2.14/Ryacas_0.2-11.zip'
Content type 'application/zip' length 263424 bytes (257 Kb)
opened URL
downloaded 257 Kb

package ‘Ryacas’ successfully unpacked and MD5 sums checked

The downloaded packages are in
    C:\Documents and Settings\yogcal\Local Settings\Temp\RtmpKeuu7m\downloaded_packages

Then I try to load Ryacas:

> library(Ryacas)
Loading required package: XML
C:\Program Files\R\R-2.14.1\library\Ryacas\yacdir\yacas.exe 
   or C:\Program Files\R\R-2.14.1\library\Ryacas\yacdir\scripts.dat 
 not found.
Run yacasInstall() without arguments to install yacas.

So then I run yacasInstall():

> yacasInstall()
trying URL 'http://ryacas.googlecode.com/files/yacas-1.0.63.zip'
Content type 'application/x-zip' length 746009 bytes (728 Kb)
opened URL
downloaded 728 Kb

And then when I try an example:

> library(Ryacas)
> yacas("TeXForm(3 * x^2/(2 * (x + 1)) - (x^3) * 2/(2 * (x + 1))^2)", 
+  retclass = "unquote")
[1] "Starting Yacas!"
Error in socketConnection(host = "127.0.0.1", port = 9734, server = FALSE,  : 
  cannot open the connection
In addition: Warning message:
In socketConnection(host = "127.0.0.1", port = 9734, server = FALSE,  :
  127.0.0.1:9734 cannot be opened
> 

What is going wrong here?

Thanks a lot...

yCalleecharan
  • 4,656
  • 11
  • 56
  • 86

2 Answers2

0

Two possibilities: 1) Yacas never got started. (R does not load Yacas for you.) 2) The connection was blocked. Assuming you started Yacas from your operating system, then you need to open up that port using your security admin tools. It's not an R issue but an operating system/firewall issue.

I may be wrong about needing to start Yacas from the Start menu. This is the code for:

runYacas()
### You should not need to type any of what follows. Just use the command above.
runYacas <- function(method = "system", yacas.args = "", yacas.init = "") {
   cmd <- yacasInvokeString(method = method, yacas.args = yacas.args, yacas.init = yacas.init)
   if (.Platform$OS.type == "windows") 
      system(cmd, wait = FALSE, invisible = FALSE)
   else system(cmd, wait = FALSE)
}

Since it seems to call the system, I would try that at your R prompt.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • @ DWin Thanks. How to know whether R has loaded Ryacas? When I type library(Ryacas), I do not get an error message. – yCalleecharan Jan 09 '12 at 20:28
  • That means Ryacas is loaded but it does not mean that Yacas has been loaded in your operating system. Yacas is being used as a server and it needs to be loaded, too. Ryacas is just the client. – IRTFM Jan 09 '12 at 20:31
  • When I type yacas at the prompt I get > yacas function (x, ...) UseMethod("yacas") – yCalleecharan Jan 09 '12 at 20:35
  • Go to the Windows Start menu and mouse-to and then click on the link to Yacas. You need to use your OS to load Yacas, which is different than the `yacas` function. After Yacas is running then you may be able to connect (if the port is not blocked). – IRTFM Jan 09 '12 at 20:40
  • @ DWin I do not have any link to Yacas on my Windows start menu. – yCalleecharan Jan 09 '12 at 20:43
  • Well it needs to be in there somewhere. Can you look in /Program Files/? – IRTFM Jan 09 '12 at 21:01
  • I have now installed Yacas, started it but that does not make a difference. I have also run "runYacas()" but I do not get any error message. Still I get the same errors. – yCalleecharan Jan 10 '12 at 12:48
0

One way to zero-in on the problem is to make sure the port is open:

1) Click Windows Start

2) Click All Programs

3) Click Accessories

4) Click Command Prompt to open a DOS window

5) Change the directory to the directory where yacas.exe is located (probably C:\Program Files\yacas\winrel) by typing cd C:\Program Files\yacas\winrel

6) Start yacas with the server by typing yacas --server 9734

7) Yacas should give you the following feedback Accepting requests from port 9734

If everything works up to this point then yacas is running and ready to talk. Now, you can run your R code. If it doesn't work, then you have a problem with yacas.

bill_080
  • 4,692
  • 1
  • 23
  • 30