Welcome to agTrend

This is the home of the R package agTrend for Bayesian inference of trends for aggregated survey data

Installing agTrend

There are two basic methods to install the agTrend package, from within R itself using the devtools package or downloading a binary appropriate to your operating system. If you are using a windows machine it is possible that you will need Rtools installed to build and install the package. There is no compiled code in agTrend.

Using devtools (guaranteed up-to-date version)

You can obtain the agTrend package using the GitHub installation function within the devtools R package. If devtools is not installed, it can be installed from CRAN by typing install.packages("devtools") from within the R console.

If devtools is installed, to install agTrend, open the R console and type

> devtools::install_github("NMML/agTrend")

Downloading a binary file

If you are using a Windows or Mac OSX machine, you can also download prebuilt binary files for installation. The Mac OSX version is available here. The windows version is downloaded here. If you are running a Linux machine, see the following section. Note: make sure your browser does not try to automatically unpack the file (this is the default for Safari, go into preferences to change this feature).

After you download the file, open R and set the working directory (e.g., using setwd("path/to/download/dir/")). Once this is set, run

> install.packages("agTrend_0.17.6.zip", repos=NULL)

If you have a mac replace with "agTrend_0.17.6.zip" with "agTrend_0.17.6.tgz".

Downloading the source file

Source files for each version can be downloaded here. The desired file can be downloaded and installed in the same way as with the binaries, e.g.,

> install.packages("agTrend_0.17.6.tar.gz", repos=NULL, type="source")

Is it installed?

However you choose to install you should see some output that, hopefully, ends with:

* installing *source* package 'agTrend' ...
** R
** data
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (agTrend)
> 

In which case, everything is installed.

Using agTrend

To begin using agTrend simply open the R console and type

> library(agTrend)

Following this you should see this output:

Loading required package: coda
Loading required package: lattice
Loading required package: Matrix
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-3. For overview type 'help("mgcv-package")'.
Loading required package: truncnorm


 agTrend 0.17.6 (2014-01-27) 

 Type 'demo(package='agTrend')' to see a list of demos for this package.

 The raw code for the demos can be found by typing:
     system.file('demo', package='agTrend')

 To access the help files type:
     help('agTrend-package')

> 

It will throw some errors if the required packages are not installed. Just install these separately using, e.g., install.packages("coda"). From here you can run the demos on Steller sea lion trends with, e.g., demo(wdpsNonpups).