--- title: "earlywarnings vignette" author: "Vasilis Dakos and Leo Lahti" date: "`r Sys.Date()`" output: html_document: toc: true number_sections: true theme: united highlight: pygments --- earlywarnings R package =========== ## Installation ### Installing and loading the release version ```{r install, eval=FALSE} install.packages("earlywarnings") ``` ### Installing and loading the experimental development version ```{r install2, eval=FALSE} library(devtools) install_github("earlywarningtoolbox/earlywarnings-R/earlywarnings") ``` ### Clone the repository & install locally: Run on command line:
git clone git@github.com:earlywarningtoolbox/earlywarnings-R.git
./build.sh
### Loading the package
```{r loading, eval=TRUE}
library(earlywarnings)
```
## Potential analysis
Potential analysis, used for instance in [Hirota et al. Science, 2011, 334, 232-235.]
```{r movpotential, message=FALSE, warning=FALSE, fig.width=5, fig.height=5}
# Create simulated example data
X <- c(rnorm(1000, mean = 0), rnorm(1000, mean = -2),
rnorm(1000, mean = 2))
param <- seq(0,5,length=3000)
# Run potential analysis
res <- movpotential_ews(X, param)
# Visualize
p <- PlotPotential(res$res, title = '',
xlab.text = '', ylab.text = '',
cutoff = 0.5, plot.contours = TRUE, binwidth = 0.2)
print(p)
```
### Licensing and Citations
This work can be freely used, modified and distributed under the
[Two-clause (Free)BSD license](https://en.wikipedia.org/wiki/BSD\_licenses).
Kindly cite the work as 'Vasilis Dakos and Leo Lahti (2014). earlywarnings R package. URL: https://github.com/earlywarningtoolbox/earlywarnings-R'.
```{r citation}
citation("earlywarnings")
```
### Session info
This vignette was created with
```{r sessioninfo}
sessionInfo()
```