On May 3, 2013, at 11:21 AM, Jony Hudson wrote:

> Hi All,
> 
> thanks for the replies. Very helpful to know that it will run with just base. 
> Looks like the best bet, at least to get started, is to not use the usual 
> build-process, but to come up with a simple build-script for just the core. 
> Ultimately, the build script has to be different anyway, as compiling the 
> Fortran code to JS requires a few more steps than the native compile.
> 
> For a bit of context, the reason I'm toying with this is I've been 
> experimenting recently with analysis-in-the-browser. The kernel of the idea 
> is that if you could do real analysis, without installing anything, and share 
> it on the web then it would be a Good Thing, and could make it easier to 
> engage people with data. I've got a proof-of-concept version running here 
> http://www.monkeycruncher.org that let's you write javascript analysis code 
> in notebook-style documents. It's neat, but it's a bit hamstrung by the lack 
> of javascript libraries to actually do any useful analysis! If you could have 
> R running in there though, that would be a much better proposition ...
> 

It seems that you want something not unlike RCloud
http://stats.research.att.com/RCloud/
It uses WebSockets to talk to R either locally or on a server. The nice thing 
about using WS is that you can leverage large clusters - are not tied to the 
local machine. Also it allows you to get the benefits of both worlds: R for 
computation + static graphics while allowing you do to cool interactive 
graphics in JavaScript. RCloud is something like iPython notebook but based on 
R with extra interactive graphics. But this is getting OT ;).

Cheers,
Simon



> I'll let you know if I make any progress!
> 
> 
> Jony
> 
> 
> --
> Centre for Cold Matter, The Blackett Laboratory,
> Imperial College London, London SW7 2BW
> T: +44 (0)207 5947741
> http://www.imperial.ac.uk/people/jony.hudson
> http://www.imperial.ac.uk/ccm/research/edm
> http://www.monkeycruncher.org
> http://j-star.org/
> --
> 
> On 3 May 2013, at 01:31, Simon Urbanek <simon.urba...@r-project.org> wrote:
> 
>> On May 2, 2013, at 6:18 PM, Gabriel Becker wrote:
>> 
>>> Jony,
>>> 
>>> I'm currently writing up the paper for something with a similar result but
>>> very different implementation. The RBrowserPlugin package/browser plugin
>>> (joint with my advisor Duncan Temple Lang) embeds R within the web browser
>>> as an NPAPI plugin.
>>> 
>>> This approach allows full bi-directional communication between R and the
>>> javascript engine (including direct function calling and references to
>>> native objects in both directions) using a user's existing local R
>>> installation (including packages).
>>> 
>> 
>> Minor detail: it requires you to have R *and* a special plugin which makes 
>> it pretty much non-deployable. It's completely unrelated to what Jony is 
>> proposing - which doesn't require any dependencies and is actually pretty 
>> cool and would be useful if feasible. FWIW: There are many ways to run R 
>> from a browser that already exist - without the need for plugins or other 
>> client-side hacks - that's the beauty of modern browsers :).
>> 
>> 
>> To get this back on the actual topic: I have been toying with 
>> cross-compiling R when I was porting it on the iPhone and it's possible, 
>> however, you can't use the build process as-is. It does build core R 
>> properly, but the problem is that you need to bootstrap R to build any 
>> packages. I worked around the problem at the time by building packages on 
>> another platform and re-using those files (things like lazy-loaded DBs, 
>> compiled RD files etc.).
>> 
>> I can imagine that you'll need some equivalent to dynamic linking, but 
>> conceptually it's nothing else but calling functions, so I think you should 
>> be able to compile each package separately and just replace the dynload code 
>> by code that loads another JavaScript. The nice thing is that packages will 
>> simply be just another JS libraries. That's all in theory, I didn't actually 
>> try that part. I suspect you'll have a lot of work, e.g. you'll need to map 
>> all the I/O operations that load compiled/stored R code, documentation, data 
>> from somewhere etc. Good luck!
>> If all fails, you can always compile R for JS/Linux ;).
>> 
>> Cheers,
>> Simon
>> 
>> 
>> 
>>> Devel source at https://github.com/gmbecker/RFirefox, release, (hopefully)
>>> officially cross-platform version to coincide with the paper going off for
>>> review.
>>> 
>>> I had toyed with the idea of the emscripten approach, but I think putting R
>>> in the browser once is enough for me at the moment so I will happily keep
>>> an eye on your project instead of attacking that myself :).
>>> 
>>> As for your actual question I can't really say, other than that I suspect
>>> you will not be able to dispense with base and methods, but that I would
>>> conjecture that stats is "optional".
>>> 
>>> ~G
>>> 
>>> 
>>> On Thu, May 2, 2013 at 9:12 AM, Jony Hudson 
>>> <jony.hud...@imperial.ac.uk>wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I'm trying to cross-compile R to javascript so that it can run in a
>>>> web-browser. Take as long as you need to stop laughing. So, as I was saying
>>>> - I want to try and get a build of R running in the browser. [If you're not
>>>> familiar with it already, you might enjoy looking at emscripten.org. It's
>>>> a remarkably capable tool for translating LLVM bitcode to javascript. Check
>>>> out some of the demos!]
>>>> 
>>>> I'm trying to start out with the most minimal build of R possible. I can
>>>> turn off various options in the configure script, but I'm wondering about
>>>> the bundled R packages (base, stats etc). I'm guessing that the native code
>>>> portions of these packages are dynamically loaded at runtime, which will
>>>> probably need patching. To start off, I'd like to not build these packages
>>>> if possible.
>>>> 
>>>> So, is there a way to configure which packages in the library get built or
>>>> is it just a case of editing the makefile? And is there a minimal set of
>>>> them that would still allow R to run (not be useful - that can come later -
>>>> just run)?
>>>> 
>>>> Thanks in advance for any help anyone can provide :-)
>>>> 
>>>> 
>>>> Jony
>>>> 
>>>> --
>>>> Centre for Cold Matter, The Blackett Laboratory,
>>>> Imperial College London, London SW7 2BW
>>>> T: +44 (0)207 5947741
>>>> http://www.imperial.ac.uk/people/jony.hudson
>>>> http://www.imperial.ac.uk/ccm/research/edm
>>>> http://www.monkeycruncher.org
>>>> http://j-star.org/
>>>> --
>>>> 
>>>> ______________________________________________
>>>> R-devel@r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Gabriel Becker
>>> Graduate Student
>>> Statistics Department
>>> University of California, Davis
>>> 
>>>     [[alternative HTML version deleted]]
>>> 
>>> ______________________________________________
>>> R-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>> 
>>> 
>> 
> 
> 

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to