How to calculate combination and permutation in R?

Maxim Veksler picture Maxim Veksler · Oct 26, 2011 · Viewed 124.4k times · Source

I just started to learn Probability, and I'm looking for tools to work with on linux.

I've found some Combinations packages http://rss.acs.unt.edu/Rdoc/library/Combinations/html/00Index.html but when I tried to install them, the process failled with the following message:

> install.packages("Combinations")
Installing package(s) into ‘/home/maxim/R/x86_64-pc-linux-gnu-library/2.13’
(as ‘lib’ is unspecified)
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ‘Combinations’ is not available (for R version 2.13.1)

Answer

PeterVermont picture PeterVermont · May 26, 2013

The function combn is in the standard utils package (i.e. already installed)

choose is also already available in the Special {base}