sand (version 1.0.2)

sand: The sand package

Description

This R package accompanies the book ‘Statistical Analysis of Network Data with R’. It contains some of the data sets used in the book (the others are in the igraphdata package). It also contains the code from the book, and some simple functions to run the code without the need for typing it in.

Arguments

In brief

Type in N to run the next chunk of code, and C to jump to Chapter x, where x is between 2 and 10. E.g. C6 resets R and “loads” Chapter 6. P prints the next code chunk to be run (without actually running it).

The data sets

The various data sets are loaded from the code chunks in the book. The sand package contains the following data sets, each is documented in its on manual page: Ecoli, aidsblog, calldata, elist.lazega, fblog, g.bip, hc, lazega, ppi.CC, sandwichprobe, v.attr.lazega.

Code chunks

Code chunks of the book are numbered by chapter and each chunk is identified the chapter number and the chunk number connected by a dot. The reader is supposed to run the code chapter by chapter, ideally, starting from a clean, new R session. This might not be critical, but it is not always possible to unload packages in R, so it is the only way to make sure that the code works correctly. To make it easy to step through the code, the sand package define some “commands”. Note that these are are not functions, and also q that they are meant to be used interactively, and not programatically.

The cursor

The cursor marks the point the reader is at in the book, and commands discussed below move the cursor and run the code the cursor is at. The ‘C’ commands clear R, i.e. unload all loaded packages except for sand and its dependencies, and delete all objects from the global workspace. They also set the cursor to the first chunk of the given chapter: there are nine ‘C’ commands, from ‘C2’ to ‘C10’, one for each Chapter of the book. (Chapter 1 has no code to run.) The command ‘N’ runs the chunk at the cursor, and steps the cursor to the next chunk. It is possible to run multiple chunks at once, with the form ‘N + x’ (with or without the spaces), where ‘x’ is the number of additional chunks to run. (I.e. ‘N + 2’ runs three chunks.) The command ‘P’ prints the chunk at the cursor, without running it. It is possible to print other chunks as well: ‘P - 1’ prints the previous chunk, ‘P - 2’ the one before that, etc., ‘P + 1’ prints the next chunk, etc. The reader is welcome to inspect R objects, or run arbitrary R code between the ‘N’ and ‘P’ commands.

See Also

install_sand_packages to install all R packages needed for the book.

Examples

Run this code
## Start with Chapter 2
C2

## Run first code chunk
N

## Run next code chunk
N

## Jump to Chapter 5
C5

## Run first code chunk in Chapter 5
## It will create a plot
N

Run the code above in your browser using DataLab