[R] R on Mobile Devices (Android)

Warren Young warren at etr-usa.com
Wed Feb 11 21:02:11 CET 2009

Gustaf Rydevik wrote:
> "3.3.2 [...]No interpreted code may be downloaded and used in
> an Application except for code that is interpreted and run by Apple's
> Published APIs and built-
> in interpreter(s)."
> and
> "An Application may not itself install or launch other executable code
> by any means, including without limitation through the use of a plugin
> architecture, calling other frameworks, other APIs or otherwise."
> I'm not too familiar with programming speech, but it seems this would
> cover R, no?

Mmmm...I think there's wiggle room here for a limited version of R.

The first clause says you couldn't have an R interpreter on the device 
that downloaded an R script and ran it.  It doesn't say you can't type 
an R script into the phone and run it there.  They're trying to block 
things like Flash and Silverlight with this restriction.  That, and the 
general security risks of running remotely-sourced content.

The second clause says install.packages() won't be allowed.  I don't see 
that it prevents you from distributing R with a pre-selected group of 
packages, however.

Keep in mind that all apps have to be approved by Apple, who haven't 
been entirely fair in their selection criteria.  And, you don't get to 
find out if they will accept the app until you finish it and submit it. 
  You risk wasting a lot of time, doing the port and then being rejected.

If you go ahead anyway, I hope you go beyond just customizing the stock 
keyboard.  I'd like to see:

- Instead of customizing the default keyboard, I'd rather have a 
calculator-like UI, with just a line or two of text at the top so you 
can see the expression, and the rest of the screen having an extended 
keyboard: letters, numbers, operator symbols, even custom buttons like 
an arrow button for assignment instead of having to type two math operators.

- Automatic parens, brackets, and quotes inference: when you've typed 
the name of a known function, add open and closed parens, and put the 
cursor between them.  In case of ambiguity -- can't do this for 
functions like print(), since you don't know if a dot is about to be 
typed to select a particular print method -- let user type open paren 
and add closed paren automatically.  Similarly, when the user types a 
bracket, quote, etc., supply the matching one and put the cursor between 
them.  Several text editors for Eclipse do this well, but not all.  A 
tricky bit is editing, where adding another quote, for instance, might 
not require the matching one to be added.

- Buttons for common functions, like plot()

- A button for downloading a data set from a web or FTP server and 
assigning it to a variable.  Basically, a wrapper around download.file() 
and read.table(), with automatic variable assignment and memory for the 
last variable name and URL used.

This is what I mean by changing the UI to match the capabilities of the 

You'll probably end up excising a lot of stuff.  PDF support for 
instance: unless Cocoa Touch includes access to PDF rendering abilities, 
I don't know that I'd bloat the binary by adding it, particularly with 
the lack of a user-visible file system.  Yes, I'm aware that there are 
tools that let you poke around in the file system, but it's not the way 
the device is meant to be used.  Maybe you could justify it if there 
were a built-in way to send the generated PDF off elsewhere, such as an 
email attachment.

Bottom line: if it were available and worked well, I'd sure use it.  I 
just don't think a straight port would do it for me.

More information about the R-help mailing list