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...
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.
As only R binary is provided as Cydia package, you have to install packages in R way via
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")
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())
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.
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:
(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
Once installed, open up a console and type: