Bioequivalence and Bioavailability Forum

Main page Policy/Terms of Use Abbreviations Latest Posts

 Log-in |  Register |  Search

Back to the forum  Query: 2017-03-27 06:48 CEST (UTC+2h)
 

Running R on Android: library(PowerTOST) [R for BE/BA]

posted by VStus - Poland, 2016-09-27 19:54  - Posting: # 16687
Views: 2,522

(edited by VStus on 2016-09-28 09:02)

Hi to all!

This post is intended to provide step-by-step HOWTO on installation of more-or-less recent version of R (3.2.5, “Very, Very Secure Dishes”) and latest version of PowerTOST package on Android devices.

In fact, most of modern smartphones are packed with quite powerful processors. As example: Samsung Galaxy S4 is approximately 40000 times more powerful than IBM System/360 Model 75J used by NASA to calculate Apollo flights trajectories (compared by Bogo MIPS). Thank's to Moore's law.

Example: R & PowerTOST in X11 via vnc viewer
[image]

Before you try: open this post in your Android's device browser, copy-paste of commands into terminal may be more convenient than typing. Check 'keyboard shortcuts' in GNURoot for more easy navigation with cursor keys and 'home' & 'end' buttons.

#Installation of programs from PlayMarket#
Programs to be installed from PlayMarket:
1. GNURoot (don't be confused, rooting is not required)
2. VNC Viewer (any VNC viewer shold work well, in fact, it's posible to connect via VNC from other device in local network).

[image]
#Configuring GNURoot#
Launch GNURoot and create Linux environment. I've tried WheezeX, because I'm familiar with Debian/Ubuntu. X means that minimal graphical system is onboard, so graphs could be displayed.
1. Create rootfs: select WheezyX
2. Run rootfs: WheezyX (to be able to install R and other Linux packages, mark 'run as fake root').
Now we are inside Linux console (bash-style):
[image]

#Configuring Debian#
Wheezy is an old version of Debian, so the R is outdated (2.5).
1. Adding R-Cran mirror with latest R backported to Wheezy (German mirror is selected by chance):
# echo "deb http://cran.uni-muenster.de/bin/linux/debian  wheezy-cran3/" | tee -a /etc/apt/sources.list
# apt-get update
# apt-get install r-base-core r-base-dev


#Dowloading and installing PowerTOST#
PowerTOST as well as most other packages should be installed from source, as only limited number of r-cran packages for R 3.2.5 have been compiled for Wheezy.
1. Download PowerTOST and mvnorm source from r-cran:
# wget https://cran.r-project.org/src/contrib/PowerTOST_1.4-2.tar.gz
# wget https://cran.r-project.org/src/contrib/mvtnorm_1.0-5.tar.gz

Successful download should look like this:
[image]
2. Install packages into R:
# R CMD INSTALL mvtnorm*
# R CMD INSTALL Power*


After this step, you should be able to run R with already installed packaged in console mode:
# R
[image]
It should be sufficient to run sample size estimations in your pocket. I may be wrong, but it seems that graphical output in console mode is automatically redirected to PDF files.

# Connecting to Linux X11 terminal via VNC Viever
1. Create new connection in VNC Viewer:
Link to VNC server - localhost:1 (or other number - check Linux console on start-up)
Password: "password"
2. Start VNC session.

PS: Performance
I'm not sure that code executed on all possible cores of your ARM processor.
> system.time(pa.scABE(CV=0.36, theta0=0.9, targetpower=0.8, minpower=0.7, design="2x2x4", regulator="EMA"))
user     system    elapsed
218.810  0.410     226.017

Command above was completed in around 3 minutes, thus the smartphone is still significantly slower than by notebook (Core i5), where it took less than minute.
user      system   elapsed
13.68       0.58      14.64


Please let me know if this is interesting/helpful.

Best regards,
Vstus


Small update: better console navigation is possible with Hacker's keyboard (PlayMarket), as it adds arrow keys and allows navigation of command history.

Disclaimer: use at your own risk!


Edit: Merged with a later post; you can edit your posts for 24 hours. [Helmut]

Complete thread:

Back to the forum Activity
 Mix view
Bioequivalence and Bioavailability Forum | Admin contact
16,693 Posts in 3,583 Threads, 1,025 registered users;
14 users online (0 registered, 14 guests).

The fundamental cause of trouble in the world today is
that the stupid are cocksure
while the intelligent are full of doubt.    Bertrand Russell

The BIOEQUIVALENCE / BIOAVAILABILITY FORUM is hosted by
BEBAC Ing. Helmut Schütz
XHTML/CSS RSS Feed