forked from MuViSU/biplotEZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
97 lines (70 loc) · 2.67 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# biplotEZ
<img src="logo.png" align="right" width="150" />
The goal of biplotEZ is to provide users an EZ-to-use platform for
visually representing their data with biplots. Currently, this package
includes principal component analysis (PCA) and canonical variate
analysis (CVA) biplots. This is accompanied by various formatting
options for the samples and axes. Alpha-bags and concentration ellipses
are included for visual enhancements and interpretation.
## Installation
You can install the development version of biplotEZ like this:
``` r
library(devtools)
devtools::install_github("MuViSU/biplotEZ")
```
## Example
This is a basic example which shows you how to construct a PCA biplot:
``` {r PCA_example}
library(biplotEZ)
biplot (iris[,1:4], Title="Test PCA biplot") |> PCA() |> plot()
```
While the PCA biplot provides a visual representation of the overall
data set, optimally representing the variance in 1, 2 or 3 dimensions,
the CVA biplot aims to optimally separate specified groups in the data.
This is a basic example which shows you how to construct a CVA biplot:
``` {r CVA_example}
biplot (iris[,1:4], Title="Test CVA biplot") |> CVA(classes=iris[,5]) |> plot()
```
An over-the-top example of changing all the formatting and adding all the
bells and whistles:
``` {r aes_example}
biplot (iris[,1:4], group.aes=iris[,5]) |> PCA() |>
samples(col="gold", pch=15) |>
axes(which=2:3, col="cyan", label.cex=1.2, tick.col="blue",
tick.label.col="purple") |>
alpha.bags (alpha=c(0.5,0.75,0.95), which=3, col="red", lty=1:3, lwd=3) |>
ellipses(alpha=0.9, which=1:2, col=c("green","olivedrab")) |>
legend.type(bags = TRUE, ellipses=TRUE) |>
plot()
```
## CA biplot
The default CA biplots represents row principal coordinates with a call such as:
```{r ca_default}
biplot(HairEyeColor[,,2], center = FALSE) |> CA() |> plot()
```
To change to row standard coordinates use a call such as:
```{r ca_standard}
biplot(HairEyeColor[,,2], center = FALSE) |>
CA(variant = "Stand") |> samples(col=c("magenta","purple"), pch=c(15,18)) |> plot()
```
## Regression biplot
With the function `regress` linear regression biplot axes can be fitted to a biplot
```{r regress}
out <- biplot(iris) |> PCO(dist.func = sqrtManhattan)
biplot(iris) |> regress(out$Z) |> plot()
```
## Report Bugs and Support
If you encounter any issues or have questions,
please open an issue on the GitHub repository.