0

I'm trying to pass a variable value from my php code to the r processing environment.

for example:

<?php

$val=5;

?>

<%

print (val)

%>

Obviously this doesn't work.

What is the right way to do it?

Thaks,

Yoni.

Update

I'm using rapache.

It works, but I would like to use php the react with the client.

Tim Post
  • 33,371
  • 15
  • 110
  • 174
yoni and tszi
  • 19
  • 1
  • 3
  • IMHO, the right way to do it is to leave PHP. Forget about it. Use `brew`! =) – aL3xa Apr 03 '11 at 03:23
  • I've merged your two unregistered accounts, you should be able to edit your question and comment under answers now. – Tim Post Apr 04 '11 at 15:23

1 Answers1

1

It looks like your options are

  • Pass your arguments from PHP to some pre-written R script using a combination of the PHP exec() command and Rscript
  • look into rapache
  • or see if you can find anything in the R FAQ on Web interfaces

At least that's what I've been able to come up with.

Erik
  • 464
  • 2
  • 5
  • Hi, Maybe i should have write it in my last msg, But I'm using rapache. It works, but I would like to use php the react with the client. Does anyone know how to it's done? – yoni and tszi Apr 04 '11 at 12:53
  • There's a sample in the [cook book](http://rapache.net/manual.html#rapache_Cookbook) section of the rapache manual. Basically it looks like you call your rApache app and pass in your parameters in either a get, post, cookie, or a file on your OS. But definitely check out the [manual](http://rapache.net/manual.html) it goes into way more detail than I can here. – Erik Apr 04 '11 at 16:45
  • Thanks for your answer. I'm new to this, so the cook book is hard for me to understand. Maybe if you can help me with the next question I will be able to fix something. Is there a way to use GET/POST without the "input" argument. I mean can I give the variable a value and not to wait for the client to press for example the submit buttem? If so, than I understend how to pass the varibels to r. – yoni and tszi Apr 04 '11 at 16:57