Installing R and RStudio

Mizer is compatible with R versions 3.1 and later. You can install R on your computer by following the instructions at [https://cran.r-project.org/] for your particular platform.

This guide assumes that you will be using RStudio to work with R. There is really no reason not to use RStudio and it makes a lot of things much easier. RStudio develops rapidly and adds useful features all the time and so it pays to upgrade to the latest version frequently. This guide was written with version 1.2.1268.

Installing the mizer package

The easiest way to install the mizer package (assuming you have an active internet connection) is to start RStudio and then type:

in the console.

After installing mizer, to actually use it you need to load the package using the library() function. Note that whilst you only need to install the package once, it will need to be loaded every time you start a new R session.

library(mizer)

Installing development version

The source code for mizer is hosted on Github. If you are feeling brave and wish to try out a development version of mizer you can install the package from here using the R package devtools (which was used extensively in putting together mizer). If you have not yet installed devtools, do

install.packages("devtools")

Then you can install the latest version from GitHub using

devtools::install_github("sizespectrum/mizer")

Using the same devtools::install_github() function you can also install code from forked mizer repositories or from other branches on the official repository.

Getting help in R

As you probably know, to access documentation in R you can use the help() function. This can be used to access package documentation in a range of ways. For example:

? mizer
help(package="mizer")
? project

The first command gives a brief introduction to mizer. The second command gives a list of all available functions. The third gives the documentation page for the function project().

Some methods are associated with several R classes. For example, the plot() method is generic and can be used on a wide range of R objects. The plot() method has been overloaded in mizer to plot MizerSim objects. To select the help page for the appropriate plotting method you can either use ?? plot and then select from a menu of packages or you can supply the package name in the help() command:

help(plot, package="mizer")

To access the the help page of a particular function you can use: ? function-name. For example, to access the help page of the getFeedingLevel() function you can use:

? getFeedingLevel

Slightly different syntax is used to get information on a class. For example, to get the help page on the MizerParams class you can use:

class ? MizerParams