R on iPhone

As iPhone is similar to Mac OSX, you can easily install R on it (if JailBroken).
* iPhone can use SSH on 3G, but this should be useful on iPod Touch / iPad(Wifi). *

110617: Sorry for not maintaining, but my iPT3’s 1st partition is just 750MB, which is too small for iOS4.
Installing gcc/R can make the system unstable...

Install R

You can manually install the tools needed for R and then compile and install R on your iPhone by yourself, but iPhone can help you by automating this process. Cydia application is GUI helper for managing Debian packages.

Firstly you have to add a repository to sources.list:

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

Now launch Cydia application, search for “R the statistical language”, then install it. Dependencies will be installed automatically.

If you still want to compile and install R by yourself check Build R section.

Install R packages

As only R binary is provided as Cydia package, you have to install packages in R way via install.packages().


For all other packages that are not provided as Debian packages, you can normally use install.packages() as it is described elsewhere. By default these packages are not installed in the same place as Debian packages, but are still installed in system-wide directory, where you need appropriate privileges. If you do not have these privileges, you can specify different location, say in your home, via lib argument.

install.packages("abind", lib = "~/R/library")

Update R packages

Packages can be updated via R’s update.packages() function. You have to specify where are non-Debian R packages installed via lib.loc argument. Under Debian this defaults to first entry in .libPaths(). The following code is intended to prevent you from getting interference between the Debian and R way of installing packages.

update.packages(lib.loc = .libPaths()[1])


Creation of Debian packages

Creating Debian packages for R packages is more or less straightforward; you can read more about it at the AliothPkgBioc group. The aim of this group is to provide Debian packages for the R packages from the upstream sources at CRAN and BioConductor. There is also a wiki describing the proces of building Debian packages.

Build R

There might be various reasons to build and install R by yourself. This text is far from exhaustive and you should consult R Installation and Administration manual for details and missing parts here.

Install build dependencies for R:

apt-get install gettext, pcre, readline, png, tiff, x11, com.ech0chrome.libbz2, com.ech0chrome.libjpeg, com.ech0chrome.xzutils, com.ech0chrome.libgfortran, com.ech0chrome.iphone-gccplus

Then download latest R aka r-devel as described in manual and unpack it into a convenient folder. Follow the manual to get recommended packages. The a INSTALL file in top directory of sources is also nice (short) piece of documentation. Then do the following commands:

  • clean previous configurations and compilations (optionally)
make clean
  • configure for your machine

(As iPhone is complicated I write down how the package is configured. Of course you can change)

./configure --enable-R-shlib --with-blas --with-lapack --with-system-zlib --with-system-bzlib --with-system-pcre --with-aqua=no --with-ICU --with-x
  • compile (this will take some time)
  • if you want, you can already start R
  • check
make check
  • and possibly install R (you need root priviligies if you choose default location i.e. /usr/local)
make install

Running R

Once installed, open up a console and type:

getting-started/installation/iphone.txt · Last modified: 2011/06/17 by ech0chrome
Recent changes RSS feed R Wiki powered by Driven by DokuWiki and optimized for Firefox Creative Commons License