Commit eb586502 by Eric Coissac

Add a full exemple in the vignette

parent be9ff0af
......@@ -276,7 +276,6 @@ The environmental variable are transformed using a Principal Component Analysis.
```{r}
env.pca = dudi.pca(env,scannf = FALSE,nf=nrow(env)-1)
env.pca.li = env.pca$li
dim(env.pca.li)
plot(env.pca.li[,1:2],cex=0,
main="Environmental data")
text(env.pca.li[,1:2],
......@@ -284,49 +283,60 @@ text(env.pca.li[,1:2],
cex=0.4)
```
### Using the package to analyse relationship among the tables
```{r}
First load the library
```{r}
library(ProcMod)
```
## Vignette Info
#### Computing the variance/covariance matix
Note the various macros within the `vignette` section of the metadata block above. These are required in order to instruct R how to build the vignette. Note that you should change the `title` field and the `\VignetteIndexEntry` to match the title of your vignette.
## Styles
```{r}
vars = mvar(euk=euk.pco.li,bac=bac.pco.li,env=env.pca.li)
```
The `html_vignette` template includes a basic CSS theme. To override this theme you can specify your own CSS in the document metadata as follows:
```{r echo=FALSE}
knitr::kable(vars)
```
output:
rmarkdown::html_vignette:
css: mystyles.css
## Figures
#### Computing the correlation matix
The figure sizes have been customised so that you can easily put two images side-by-side.
```{r}
cors = mcor(euk=euk.pco.li,bac=bac.pco.li,env=env.pca.li)
```
```{r, fig.show='hold'}
plot(1:10)
plot(10:1)
```{r echo=FALSE}
knitr::kable(cors)
```
You can enable figure captions by `fig_caption: yes` in YAML:
#### Building the multiprocruste model
output:
rmarkdown::html_vignette:
fig_caption: yes
```{r}
euk.pm = pm(euk.pco.li ~ bac.pco.li + env.pca.li)
euk.pm
```
Then you can use the chunk option `fig.cap = "Your figure caption."` in **knitr**.
results can be ploted like a classical prooruste result
## More Examples
```{r}
plot(euk.pm)
```
You can write math expressions, e.g. $Y = X\beta + \epsilon$, footnotes^[A footnote here.], and tables, e.g. using `knitr::kable()`.
finaly the analysis of the variance corresponding to this model
```{r, echo=FALSE, results='asis'}
knitr::kable(head(mtcars, 10))
```{r}
euk.anova = anova(euk.pm)
euk.anova
```
Also a quote using `>`:
Partition of the variance among the factors
```{r}
partition = euk.anova[,"Sum Sq"]/sum(euk.anova[,"Sum Sq"])
names(partition)=rownames(euk.anova)
partition
```
> "He who gives up [code] safety for [code] speed deserves neither."
([via](https://twitter.com/hadleywickham/status/504368538874703872))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment