R on the iPhone

September 12, 2010
By

(This article was first published on Computational Mathematics » R, and kindly contributed to R-bloggers)

iPhone users who have jailbroken their phone have been able to compile R for a while now since they have access to the command line via MobileTerminal.  However, I just recently found out that a package is now up on Cydia to ease installation. So I fired up my iPhone 4 and installed R on it just for fun using the instructions here.

I’ll write out the complete steps for installing R onto the iPhone here as they are actually quite simple:

1. Have a jailbroken iPhone and the Cydia package manager app installed
(instructions not provided here).

2. Install OpenSSH and MobileTerminal via Cydia
Note that if you are running iOS 4, the current version of MobileTerminal on Cydia does not work properly, you’ll need to get an updated version from:

MobileTerminal 354.3-12 Debian package

Copy the file to your iPhone via SFTP (or download it to your iPhone directly) and then install it via SSH using:

dpkg -i mobileterminal_364.3-12_iphoneos-arm.deb

3. Add a new repository to Cydia
In Cydia, go to Manage->Sources and Add the following repository:

http://leafmoon.users.sourceforge.net/cydia/

4. Install R the Statistical Language
Use Search to find it, if you cannot, make sure your user level is either Hacker or Developer level under Manage->Settings because R is a command-line program so it will not show up if you are at the User level. You can change your level back to User immediately afterwards.

5. Run R from command line
Load up MobileTerminal and run R by simply typing:

R

Other notes

  • As it is based on command-line, plots are generated as files in the directory you start R in, as opposed to being displayed on screen.
  • Packages need to be installed and updated with the install.packages() and upgrade.packages() commands respectively
  • I recommend portrait mode as the keyboard seems to take up less screen estate but that’s just personal preference.
  • I’ve only tried this on iPhone 4′s retina display and it is barely usable so perhaps older iPhones would struggle with the readability.
  • As of the time of writing this post, the packaged R version is R 2.10.1. If you need a newer version, you will have to wait for an updated package or compile from source.

Thanks to ech0chrome for the Cydia repository and the reference instructions.

To leave a comment for the author, please follow the link and comment on his blog: Computational Mathematics » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.