knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )

```
library(wrappedtools)
```

The goal of 'wrappedtools' is to make my (and possibly your) life a bit easier by a set of convenience functions for many common tasks like e.g. computation of mean and SD and pasting them with ±. Instead of\ paste(round(mean(x),some_level), round(sd(x),some_level), sep='±')\ a simple meansd(x, roundDig = some_level) is enough.

You can install the released version of 'wrappedtools' from github with:

devtools::install_github("abusjahn/wrappedtools")

```
library(wrappedtools)
```

This is a basic example which shows you how to solve a common problem, that is, describe and test differences in some measures between 2 samples, rounding descriptive statistics to a reasonable precision in the process:

# Standard functions to obtain median and quartiles: median(mtcars$mpg) quantile(mtcars$mpg,probs = c(.25,.75)) # wrappedtools adds rounding and pasting: median_quart(mtcars$mpg) # on a higher level, this logic leads to compare2numvars(data = mtcars, dep_vars = c('wt','mpg', "disp"), indep_var = 'am', gaussian = F, round_desc = 3)

To explain the '**wrapper**' part of the package name, here is another
example, using the ks.test as test for a Normal distribution, where
ksnormal simply wrapps around the ks.test function:

somedata <- rnorm(100) ks.test(x = somedata, 'pnorm', mean=mean(somedata), sd=sd(somedata)) ksnormal(somedata)

Saving variable selections: Variables may fall into different groups: Some are following a Gaussian distribution, others are ordinal or factorial. There may be several grouping variables like treatment, gender... To refer to such variables, it is convenient to have their index and name stored. The name may be needed as character or , symbol, complex variable names like "size [cm]" may need to be surrounded by backtics in some function calls but must not have those in others.\ Function FindVars finds columns in tibbles or dataframes, based on name pattern. This is comparable to the selection helpers in 'tidyselect', but does not select the content of matching variables, but names, positions, and count:

gaussvars <- FindVars(varnames = c('wt','mpg'), allnames = colnames(mtcars)) gaussvars #Exclusion based on pattern factorvars <- FindVars(varnames = c('a','cy'), allnames = colnames(mtcars), exclude = c('t')) factorvars$names

This should give you the general idea, I'll try to expand this intro over time...

**Any scripts or data that you put into this service are public.**

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.