---
title: "BiVariAn Description"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{bivarian-description}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

# BiVarian Description

BiVariAn is a package designed to facilitate bivariate and multivariate statistical analysis. It includes various functions that enhance conventional workflows by incorporating loops for different types of statistical analyses, such as correlation analysis, two-group comparisons, and multi-group comparisons.
Each function automatically performs parametric and non-parametric tests based on the specific situation, allowing for user-defined arguments that can be utilized by the methods within the function.
In addition to bivariate analyses, BiVariAn can also automate predictor selection processes according to statistical significance levels based on the p-value. This is achieved through functions such as `step_bw_p` and `step_bw_firth`. 
Furthermore, the package allows for the automated creation of various types of graphs, with user-customizable arguments, including density plots, bar charts, box plots, violin plots, and pie charts.
Thus, the automation of extensive processes is streamlined thanks to the functions provided in this package.


```{r setup}
library(BiVariAn)
```

Loading the package

``` r
library(BiVariAn)
```

Render an automatic Shapiro-Wilk's table of a simple dataset

```{r, warning=FALSE}
auto_shapiro_raw(cars)

shapiro.test(cars$speed)
```

Return Shapiro-Wilk's results as a dataframe

```{r}
auto_shapiro_raw(cars, flextableformat = FALSE)
```

Render an automatic Shapiro-Wilk's table of a more complex dataset

```{r}
# Load riskCommunicator to access Framingham dataset
library(riskCommunicator)
```

```{r, message=FALSE}
# Load dplyr to select specific columns
library(dplyr)
data(cvdd)
```

For shapiro.test, sample size must be between 3 and 5000

Let's select only 300 observations (arbitrary)

```{r}
set.seed(081224)
ex_sample<-slice_sample(cvdd, n=300)
```

Now, let's select specific columns from the database

```{r}

auto_shapiro_raw(ex_sample %>% select(TOTCHOL, SYSBP, DIABP, BMI, HEARTRTE))
```

Common use of shapiro.test

```{r}
shapiro.test(ex_sample$TOTCHOL)
```

Return the same Shapiro-Wilk's results as a dataframe

```{r}
auto_shapiro_raw(ex_sample %>% select(TOTCHOL, SYSBP, DIABP, BMI, HEARTRTE), flextableformat = FALSE)
```
