R package dependencies


CRAN at the moment (2017-01-13 01:09:18) has 9884 R packages.

Quite a few of these packages are required by other packages (by Depends, Imports, or LinkingTo)

Required by Packages
0 7549
1-9 1805
10-99 393
100-999 111
1000-1999 18
2000+ 8

So there are 8 packages required by 2000 or more other packages.

The 30 packages which are required by the highest numbers of other packages are:

These top 30 packages were written by the following authors:

pkg Required by Authors
Rcpp 3451 Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou, Nathan Russell, Douglas Bates and John Chambers
lattice 3411 Deepayan Sarkar
MASS 2873 Brian Ripley, Bill Venables, Douglas M. Bates, Kurt Hornik (partial port ca 1998), Albrecht Gebhardt (partial port ca 1998), David Firth
Matrix 2378 Douglas Bates and Martin Maechler
magrittr 2239 Stefan Milton Bache and Hadley Wickham
stringi 2061 Marek Gagolewski (stringi source code); IBM and other contributors (ICU4C 55.1 source code); Unicode, Inc. (Unicode Character Database)
digest 2023 Dirk Eddelbuettel with contributions by Antoine Lucas, Jarek Tuszynski, Henrik Bengtsson, Simon Urbanek, Mario Frasca, Bryan Lewis, Murray Stokely, Hannes Muehleisen, Duncan Murdoch, Jim Hester, Wush Wu, Qiang Kou, Thierry Onkelinx, Michel Lang and Viliam Simko.
stringr 2007 Hadley Wickham, RStudio
plyr 1809 Hadley Wickham
assertthat 1744 ‘Hadley Wickham’
lazyeval 1713 Hadley Wickham, RStudio
tibble 1701 Hadley Wickham, Romain Francois, Kirill Müller, RStudio
RColorBrewer 1570 Erich Neuwirth
colorspace 1550 Ross Ihaka, Paul Murrell, Kurt Hornik, Jason C. Fisher, Reto Stauffer, Achim Zeileis
reshape2 1489 Hadley Wickham
dichromat 1446 Thomas Lumley, Scott Waichler
labeling 1445 Justin Talbot
munsell 1444 Charlotte Wickham
scales 1443 Hadley Wickham, RStudio
gtable 1421 Hadley Wickham
ggplot2 1407 Hadley Wickham, Winston Chang, RStudio
R6 1236 Winston Chang
mime 1172 Jeffrey Horner, Yihui Xie
nlme 1066 José Pinheiro (S version), Douglas Bates (up to 2007), Saikat DebRoy (up to 2002), Deepayan Sarkar (up to 2005), EISPACK authors (src/rs.f), Siem Heisterkamp (Author fixed sigma), Bert Van Willigen (Programmer fixed sigma), R-core
jsonlite 1017 Jeroen Ooms, Duncan Temple Lang, Lloyd Hilaiel
codetools 1002 Luke Tierney
survival 905 Terry M Therneau, Thomas Lumley (original S->R port and maintainer until 2009)
cluster 895 Martin Maechler, Peter Rousseeuw (Fortran original), Anja Struyf (S original), Mia Hubert (S original), Kurt Hornik (port to R; maintenance(1999-2000)), Matthias Studer, Pierre Roudier, Juan Gonzalez
xtable 876 David B. Dahl
iterators 839 Rich Calaway, Revolution Analytics, Steve Weston

When I produced the first version of this report in December 2015, I simply used pkgDepends to (recursively) find the the complete dependency graph of the packages on CRAN. This time, doing this for all almost 10,000 packages took too long,
so I used available.packages do get the one-step list of dependencies, build the (alsmost ) 10,000 x 10,000 adjacency matrix, and then used the SparseM packages to compute the matrix powers to get the complete dependency graph. Computing matrix powers without SparseM also proved to be infeasibly time consuming.


RStudio on RaspberryPi 3

I have been able to build RStudio server on my RaspberryPi 3.
One change was crucial: I added a 16GB swap file on an external disk to my system (mounting the external drive and using dphys-swapfile – available in Raspbian)
I used the current version of Raspbian (Jessie), updated all packages,
and did
sudo apt-get install pandoc pandoc-citeproc
I also built R 3.3.2 from the sources (since the Raspbian repo only has R 3.1.1).

Installation of R went smoothly just with configure and make.

A few times durning build, the were notifications of missing (system) libraries, but the instructions what to install (using sudo apt-get install) were clear enough to finish the build).
Then I dowloaded the RStudio source from github and followed
the build instructions.

The process is not finished after
make install
but the INSTALL instructions are very clear about how to get the server up and running.

One minor change need to be made:
RStudion installs x86 binaries of pandoc and pandoc-citeproc in
/usr/local/lib/rstudio-server/bin/pandoc
These binaries have to be renamed (or deleted), than RStudio will use the binaries installed
from the Raspbian repo.

R package dependencies


CRAN at the moment (2015-12-12 12:25:37) has 7610 R packages.

Quite a few of these packages are required by other packages (by Depends, Imports, or LinkingTo)

Required by Packages
0 5791
1-9 1412
10-99 305
100-999 91
1000-1999 8
2000 3

So there are 3 packages required by 2000 or more other packages.

The 30 packages which are required by the highest numbers of other packages are:

dephist

These top 30 packages were written by the following authors:

Package Required by Authors
lattice 2377 Deepayan Sarkar
Rcpp 2044 Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou, Douglas Bates and John Chambers
MASS 2022 Brian Ripley, Bill Venables, Douglas M. Bates, Kurt Hornik (partial port ca 1998), Albrecht Gebhardt (partial port ca 1998), David Firth
Matrix 1352 Douglas Bates and Martin Maechler
magrittr 1327 Stefan Milton Bache and Hadley Wickham
stringi 1283 Marek Gagolewski and Bartek Tartanus (stringi source code); IBM and other contributors (ICU4C 55.1 source code); Unicode, Inc. (Unicode Character Database)
stringr 1263 Hadley Wickham, RStudio
digest 1259 Dirk Eddelbuettel with contributions by Antoine Lucas, Jarek Tuszynski, Henrik Bengtsson, Simon Urbanek, Mario Frasca, Bryan Lewis, Murray Stokely, Hannes Muehleisen, Duncan Murdoch, Jim Hester and Wush Wu.
plyr 1171 Hadley Wickham
colorspace 1027 Ross Ihaka, Paul Murrell, Kurt Hornik, Jason C. Fisher, Achim Zeileis
RColorBrewer 1018 Erich Neuwirth
reshape2 956 Hadley Wickham
dichromat 924 Thomas Lumley, Scott Waichler
labeling 923 Justin Talbot
munsell 923 Charlotte Wickham
scales 922 Hadley Wickham, RStudio
proto 915 Louis Kates, Thomas Petzoldt
gtable 908 Hadley Wickham
ggplot2 895 Hadley Wickham, Winston Chang
nlme 802 José Pinheiro (S version), Douglas Bates (up to 2007), Saikat DebRoy (up to 2002), Deepayan Sarkar (up to 2005), EISPACK authors (src/rs.f), R-core
cluster 692 Martin Maechler, Peter Rousseeuw (Fortran original), Anja Struyf (S original), Mia Hubert (S original), Kurt Hornik (port to R; maintenance(1999-2000)), Matthias Studer, Pierre Roudier
survival 668 Terry M Therneau, Thomas Lumley (original S->R port and maintainer until 2009)
codetools 645 Luke Tierney
mvtnorm 607 Alan Genz, Frank Bretz, Tetsuhisa Miwa, Xuefei Mi, Friedrich Leisch, Fabian Scheipl, Bjoern Bornkamp, Martin Maechler, Torsten Hothorn
iterators 547 Rich Calaway, Revolution Analytics, Steve Weston
foreach 536 Rich Calaway, Revolution Analytics, Steve Weston
zoo 484 Achim Zeileis, Gabor Grothendieck, Jeffrey A. Ryan, Felix Andrews
nnet 466 Brian Ripley, William Venables
xtable 455 David B. Dahl
R6 422 Winston Chang

Emacs and spell on a Mac

I had some trouble installing aspell in Emacs on my Mac, so here is what I did to make it work.

I installed Emacs 24.4 from the Emacs for OS X web site, and I installed cocoAspell from its web site.

Additionally I installed the German dictionary from the aspell dictionary web site accessible from the cocoAspell web site.

As described in the docs, I installed the additional dictionary directory into /Library/Application Support/cocoAspell/ by unzipping the archives from the cocoAspell site. This created a subdirectory for the dictionaries, in my case /Library/Application Support/cocoAspell/aspell6-de-2030222 in addition to /Library/Application Support/cocoAspell/aspell6-en-6.0-0 which was created by the cocoAspell installation itself.

Then, I created a new directory /Library/Application Support/cocoAspell/aspell6-combined and copied all files from the other two dictionaries directories into these new directories.

Then I edited the file /usr/local/etc/aspell.conf. I replaced the line

dict-dir /usr/local/lib/aspell-0.60

by

dict-dir /Library/Application Support/cocoAspell/aspell6-combined

All these action need admin privileges, so in most cases one has to use sudo to run the commands.

In the final step, I had to start Emacs, and navigate to Tools -> Spell Checking -> Customize and set the value for Ispell dictionary to default

After that, I could use the menu items on Edit -> Spell, and using there, I also could switch between English and German.

Netlogo, the R extension, and Mountain Lion

The R extension for Netlogo (available fromneeds sone environment variables to point to R and JRI (an R tool for connecting R and Java). Until Lion, a plist file ~/.MacOSX/environment.plist could be used to define environment variables which then could be accessed by OSX appellations (started by clicking in Finder)

Mountain Lion does not use the environment.plist file any more. Therefore, we need other tricks to create these environment variables. The have to be set in the Info.plist file of the Netlogo applications.

To access this file, got into the Netlogo directory (currently /Applications/Netlogo 5.0.2) and do Ctrl-Click on the Application (currently Netlogo 5.0.2 or Netlogo 5.0.2.app, depending on your system settings). Select Show Package Contents on the drop down menu and then go into the Contents directory. There, you can see the file Info.plist

We have to add some items to this file. This can be done either with a text editor or with the PList editor in Xcode (if Xcode is installed on the computer).

Editing Info.plist using a text editor

Ctrl-Click the file Info.plist and select the editor to open the file in the Open With drop down menu item.

The end of this file will look like this:

<key>NSJavaRoot</key>
<string>..</string>
</dict>
</plist>

We add a few lines so that the end of the file looks like this:

<key>NSJavaRoot</key>
<string>..</string>
<key>LSEnvironment</key>
<dict>
<key>JRI_HOME</key>
<string>/Library/Frameworks/R.framework/Resources/library/rJava/jri</string>
<key>R_HOME</key>
<string>/Library/Frameworks/R.framework/Resources</string>
</dict>	
</dict>
</plist>

Save the file. From now on, the R extension of Netlogo should work.

Editing Info.plist using XCode

If Xcode is installed, just double clicking Info.plist will open it in the PList editor of Xcode.
On the menu, close Editor and then click in on then Show Raw Keys & Values item . It needs to be checked with a check mark. The editor window displays a few lines. The last line should be Java root directory. Select the line and on the Xcpde menu do Editor -> Add Item. A new line will appear; on the dropdown of this line, select LSEnvironment.
The editor then will set the type to dictionary. Click on the triangle to the left of LSEnvironment to make it point down. Now click the + sign on the LSEnvironment line. In the new line, the value for key is New item and the Type is String. Set the value for key to JRI_HOME to /Library/Frameworks/R.framework/Resources/library/rJava/jri.
In the same way, create a second key R_HOME and set its value to /Library/Frameworks/R.framework/Resources/library/rJava/jri.
Save the file.

The R extension of Netlogo now should work.

OLPC ≈ Sugar on a Stick ≈ SoaS on Asus Eee PC R11CX

This is an update modifying the original blog entry.

Today, I tried to create a bootable SD Card with SoaS for an Asus Eee PC.

Ultimately, I was successful. The sugarlabs Wiki has installation instructions. Following this instructions alone however, does not finish the job. Some additional work has to be done before after one can run the command (which is the essence of the wiki page just mentioned).

./livecd-iso-to-disk --reset-mbr --overlay-size-mb 500 --home-size-mb 900 --delete-home --unencrypted-home /run/initramfs/livedev /dev/sda1

sda1 might be something slightly different, like sdb1 or similar.

So let us start and do things one after the other.
After having started Fedora-Soas-Live in your VM program insert the SD card you want to use in the SD card reader of your machine. You might need to connect it to your VM.
To find the device you want to use
df -Th
You will recognize the SD card by the size displayed for all devices. Its name will be /dev/sda1 or something similar
This instruction will run a test and then tell you that the device is unmounted. So before you run this command a second time,


umount /dev/sda1

Try the lived-iso-to-disk command mentioned above again. You might be told the the partition is not boo table. You will get instructions how to start parted.


/sbin/parted /dev/sda

Once parted is started, enter the following commands


toggle 1 boot
quit

Then run the complete lived-iso-to-disk command once again and you will have a bootable removable storage device with SoaS.

Depending on the size of your SD card you might change some parameters. I used

./livecd-iso-to-disk --reset-mbr --overlay-size-mb 2000 --home-size-mb 2000 --delete-home --unencrypted-home /run/initramfs/livedev /dev/sda1

Additional remarks:
I was unable to use VirtualBox on my Mac, Virtualbox could not access the internal card reader, tip produced an error message when I tried to connect the SD card to the VM.

I also was unable to use VirtualBox with a multicardreader on Windows.

Parallels on the Mac worked, and a single slot USB card reader on my Windows machine worked.

R and Emacs with org mode

Who should read this document

I recently learned about org mode for Emacs. Among other things, it allows to mix text and R source code similar to SWeave, but the markup for text is very simple.

To get things working can be complicated, especially if one is not an experienced user. Therefore this documents is intended to help novices with Emacs getting up and running as fast as possible.

Emacs is heavily keyboard based. In the following text C- will indicate the Control key pressed together with another key. Likewise, M- is the Altkey
(Meta key was the original name), and S- is set shift key. So C-c indicates Control key pressed simultaneously with c key, M-x indicates Alt key pressed simultaneously with x key.

A very minimalistic demo

The following example does not try to explain the options, I just want to help you to get up an running as fast as possible.

Let us look at an example of org code:

#+TITLE: Using org mode with R
#+AUTHOR: Erich Neuwirth
 
* Minimalistic demo
 
Just a piece of R code producing outpout
 
#+BEGIN_SRC R :session *R* :exports both
123*456
#+END_SRC
 
It also allows including plots in output
 
#+BEGIN_SRC R :session *R* :results output graphics :file first.png :exports both
x <- (0:100)/100
y <- x^2
plot(x,y,type="l",xlab=expression(x),ylab=expression(f(x)==x^2),
  main="Quadratfunktion")
#+END_SRC
 
We can use the modern plotting package ~ggplot2~
 
#+BEGIN_SRC R :session *R* :results output graphics :file second.png :exports both
library(ggplot2)
x <- (0:100)/100
y <- x^2
qplot(x,y,geom="line",xlab=expression(x),ylab=expression(f(x)==x^2),
  main="Quadratfunktion")
#+END_SRC
 
 
And it can produce nice tables
 
#+BEGIN_SRC R :results output org :exports both
library(ascii)
a <- runif(100)
c <- "Quantiles of 100 random numbers"
b <- ascii(quantile(a),header=TRUE,include.colnames=TRUE)
print(b,type="org")
rm(a,b,c)
#+END_SRC
 
 
We even can embed source code to perform computations
in-line: 
 
1+2 = src_R[:session *R*]{1+2}
 
And we can embed mathematical formulas
 
$$\Phi(x|\mu,\sigma)=\int_{-\infty}^{x}\frac{1}{\sqrt{2\pi\sigma}}e^{\frac{(t-\mu)^2}{2\sigma^2}}dt$$

Converting this org file into html produces
this page.

Converting this org file into TeX and pdf produces this page.

If your Emacs is configured correctly, all you have to to is to copy the above text into a file
with extension .org and open this file in Emacs. In Emacs then just press the keys
C-c C-e b.

Putting the cursor in one of the code snippets in the file and pressing the keys C-c C-c will put the results of the computation (with additional markup) directly after the code snippet.

All this will, however, not work if Emacs is not configured correctly.

Configuring Emacs

We describe how to setup Emacs on Windows and on OSX
To be able to run this in Vincent Goulet’s Emacs (available from his site) for Windows and for OSX.

Emacs has to be configured to make org mode with R work. Configuration of Emacs is usually done by statements in a file names .emacs in the directory Emacs considers your home directory.
If your installation of Emacs is new, you might not yet have this file.

You can open (or create if necessary) this file by starting Emacs and typing C-x C-f. Then the bottom line of the Emacs window will display ~/ and wait for you to enter a file name. Just type .emacs. Now we need to copy some commands into this file.

On Windows, Emacs org mode needs soe help to find the correct version of R.
Since org mode and ESS (Emacs Speaks Statistics, used by org mode) are under very vivid development, this might change in the near future.
On OSX, no special initialization is necessary for this.
Therefore we have three slightly different versions of the initialization file for the different OSes.

On Windows with 32bit R and a standard installation, then following code is needed in .emacs

;; At first, we make sure that our modifications in .emacs
;; are applied _after_ default.el is read/
(setq inhibit-default-init t)
(load "default.el")
;; We ensure that Emacs can copy from and to the clipboard
(setq x-select-enable-clipboard t)
 
;; Now we set up Emacs to find R
;; The path to R might need to be changed
(setq-default inferior-R-program-name
	      "C:/Program Files/R/R-2.15.3/bin/i386/Rterm.exe")
(setenv "PATH" (concat "C:\\Program Files\\R\\R-2.15.3\\bin\\i386" ";"
    (getenv "PATH")))
 
;; Configuring org mode to know about R and set some reasonable default behavior
(require 'ess-site)
(require 'org-install)
(org-babel-do-load-languages
  'org-babel-load-languages
  '((R . t)
   )
)
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
(add-hook 'org-mode-hook 'org-display-inline-images)
(setq org-confirm-babel-evaluate nil)
(setq org-export-html-validation-link nil)
(setq org-export-allow-BIND t)
(setq org-support-shift-select t)
(setq org-src-fontify-natively t)

For 64bit R in a standard installation you need

;; At first, we make sure that our modifications in .emacs
;; are applied _after_ default.el is read/
(setq inhibit-default-init t)
(load "default.el")
;; We ensure that Emacs can copy from and to the clipboard
(setq x-select-enable-clipboard t)
 
;; Now we set up Emacs to find R
;; The path to R might need to be changed
(setq-default inferior-R-program-name
	      "C:/Program Files/R/R-2.15.3/bin/x64/Rterm.exe")
(setenv "PATH" (concat "C:\\Program Files\\R\\R-2.15.3\\bin\\x64" ";"
    (getenv "PATH")))
 
;; Configuring org mode to know about R and set some reasonable default behavior
(require 'ess-site)
(require 'org-install)
(org-babel-do-load-languages
  'org-babel-load-languages
  '((R . t)
   )
)
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
(add-hook 'org-mode-hook 'org-display-inline-images)
(setq org-confirm-babel-evaluate nil)
(setq org-export-html-validation-link nil)
(setq org-export-allow-BIND t)
(setq org-support-shift-select t)
(setq org-src-fontify-natively t)

For OSX on a Mac you need

;; At first, we make sure that our modifications in .emacs
;; are applied _after_ default.el is read/
(setq inhibit-default-init t)
(load "default.el")
;; We ensure that Emacs can copy from and to the clipboard
(setq x-select-enable-clipboard t)
 
;; Configuring org mode to know about R and set some reasonable default behavior
(require 'ess-site)
(require 'org-install)
(org-babel-do-load-languages
  'org-babel-load-languages
  '((R . t)
   )
)
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
(add-hook 'org-mode-hook 'org-display-inline-images)
(setq org-confirm-babel-evaluate nil)
(setq org-export-html-validation-link nil)
(setq org-export-allow-BIND t)
(setq org-support-shift-select t)
(setq org-src-fontify-natively t)

Copy the code for your OS into you Emacs window displaying the (initially possibly empty) .emacs file. Then save the file with C-x C-s and close Emacs with C-x C-c.
You are now ready to run our demo.

Running the demo

Now start Emacs again, type C-x C-f and then type OrgWithR.org to open a new file. Copy the text from the first code window of this document into Emacs and type C-x C-s to save the file.
Type C-c C-e and in the options window that appears type b. After a few seconds the html file will be displayed in a browser.
Type C-c C-e and in the options window that appears type d. After a few seconds the pdf file will be displayed in a browser.
Put the cursor into a code segment (somewhere between #+begin_src and #+end_src and type C-c C-c. The results of running the code will appear just below the code segment.

Close Emacs and open the file OrgWithR.org you just created. You might be surprised that you see only the first few lines, like this.

#+TITLE: Using org mode with R
#+AUTHOR: Erich Neuwirth
 
* Minimalistic demo...

Putting the cursor (called point in Emacs speak) into the line Minimalistic Demo... and pressing TAB will expand the file. Pressing TAB in this line again will collapse the text. This way, you can hide or show selected parts of your document while working with it.

Further tips

On Windows you are in for a surprise. Emacs by default does not use C-c/C-x/C-v for Copy/Cut/Paste. The Options menu, however, has an item to use the standard windows keys for these operations.

How do you learn Emacs and org mode?

Emacs itself has a very nice tutorial accessible from the opening screen.

Org mode tutorials can be found at http://orgmode.org/worg/org-tutorials/index.html.

A tutorial on using org mode with R can be found at http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html

If you also want spell checking, just download and install Aspell. The Windows version is available at http://aspell.net/win32/. You need to install the dictionaries separately from this site.

On Macs with OSX you can use cocoAspell available from http://cocoaspell.leuski.net/. The installer from there does include the English dictionary, but it is not completely activated. To activate it, open a Terminal window and run the following commands:

cd /Library/Application\ Support/cocoAspell/aspell6-en-6.0-0
sudo ./configure
sudo make install

If you need to install other dictionaries, get the archive files from
ftp://ftp.gnu.org/gnu/aspell/dict, unpack the archive(s) and run the ./configure and sudo make install commands in the unpacked directory.

Transparenzgesetz.at Info-Logo