R on the iPhone

[This article was first published on Computational Mathematics » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 their blog: Computational Mathematics » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)