Table of Contents
Package Intergraph
R world provides several packages for working with network data. This package supplements that functionality by providing methods for converting network data objects between classes defined in other packages.
Currently supported classes/packages: network
, and igraph
.
See this post on my blog and all the other posts tagged with a tag 'intergraph'.
network
. The new version has R namespace implemented. Consequently, package intergraph
will work with this new version out of the box. You do not have to install my “hacked” version as described below.
Consequently,
install.packages("intergraph", repos="http://bojan.3e.pl/R")
should suffice to install intergraph
to the default R library tree.
Installation instructions
Package intergraph
depends on package network
. To be able to work reliably with the network
package it has to have a namespace. At this moment (September, 2010) the network
package does not have a namespace so I had to create a version that does have one. Until the official network
package will have a namespace to use the intergraph
package you have to download and install my modified version of network
. See below for one way how to do that.
Namespaced version of ''network''
To install namespaced version of the network
package (tagged with version 1.4-1-1):
From sources
On Linux-alikes you can install it directly from R by using the function install.packages
. Using default settings of install.packages
will install the namespaced network
package to the default R library tree.
The default library R tree is the directory in the first element returned by .libPaths()
.
Most likely you have already an “official” version of the network
package installed there so it will get overwritten.
If you are OK with that proceed as in item (1) below.
- Installing to default library tree
- Call
install.packages("network", contriburl="http://bojan.3e.pl/R/hacks")
- Installing to a separate library tree (recommended)
- Create a new directory somewhere, for example
~/lib/R
. This may be any directory you have a permission to write to. For the remaining items below we will assume it is~/lib/R
. If you choose something else substitute it in the calls below. - Install the package there by calling
install.packages
with an extra argumentlib
set to this new directory. Taking the one for the preceding item the call would look like this:install.packages("network", lib="~/lib/R", contriburl="http://bojan.3e.pl/R/hacks")
- After the package is installed there are several ways to load that package while in the R session:
- Use
library
function with an additionallib
argument, much like withinstall.packages
above:library(network, lib="~/lib/R")
- Let R know of the extra library tree we just created by registering it with a call to
.libPaths
and then use thelibrary
function as usual. Please mind however, that the namespaced version package will have “priority” over any other version of thenetwork
package you might have installed to the other directories. With this approach you will:.libPaths("~/lib/R") # register the extra library tree library(network) # load the package
On Windows
At this moment I provide Windows binary versions only for R versions 2.9, 2.10, and 2.11.
To install the Windows binary version of the package you can use install.packages
function from within R. By default it will install the package to default library tree. R's default library tree is the directory on the first position in the vector returned by calling .libPaths()
.
Most likely you have already installed an official version of the network
package there. In such case using install.packages
with default settings would overwrite the already installed version. If you are OK with that proceed as in the item 1. below. If not, you can install the package into a separate library tree as explained in the item 2.
- To install a Windows binary version to the default library tree use one of:
install.packages("network", contriburl="http://bojan.3e.pl/R/hacks/2.9") install.packages("network", contriburl="http://bojan.3e.pl/R/hacks/2.10") install.packages("network", contriburl="http://bojan.3e.pl/R/hacks/2.11")
depending on your R version.
- To install into a separate library tree (recommended)
- Create a new directory somewhere, for example
c:\R\mylibrary
. This may be any directory you have a permission to write to. For the remaining items below we will assume it isc:\R\mylibrary
. If you choose something else substitute it in the calls below. - Run one of the above commands with an additional argument
lib
set to the path to that new directory. The package will be installed there. So, for example, to install the package for R version 2.11 you would use (mind the use of forward slashes):install.packages("network", lib="c:/R/mylibrary", contriburl="http://bojan.3e.pl/R/hacks/2.11")
- After the package is installed you can load it with one of:
- Use
library
function with an additionallib
argument, much like withinstall.packages
above:library(network, lib="c:/R/mylibrary")
- Let R know of the extra library tree we just created by registering it with a call to
.libPaths
and then use thelibrary
function as usual. Please mind however, that the namespaced version package will have “priority” over any other version of thenetwork
package you might have installed to the other directories. With this approach you will:.libPaths("c:/R/mylibrary") # register the extra library tree library(network) # load the package
Installing ''intergraph''
To install the intergraph
package to the default library tree on both Windows or Linux-alikes use
install.packages("intergraph", repos="http://bojan.3e.pl/R")