The [su_label]Rsample[/su_label] package contains functions that allow different types of resampling (e.g. cross-validation, bootstrap, etc.). The data structure in which resampling data is stored is a data frame and is very convenient for further work. You can read more about the [su_label]Rsample[/su_label] package on the…

# Month: July 2018

## Quick start with R: Recoding (Part 20)

You can re-code an entire vector or array at once. To illustrate, let’s set up a vector that has missing values. A

## Quick start with R: Count values within cases (Part 19)

SPSS has the Count Values within Cases option, but R does not have an equivalent function. Here are two functions that you might find helpful, each of which counts values within cases inside a rectangular array. For example, you might have a dataset consisting of…

## Quick start with R: Using any() and all() commands (Part 18)

Test for the existence of particular values using the any() and all() commands Create a vector b: b

## Quick start with R: Conditional counting (Part 17)

Counting elements in a dataset Combining the length() and which() commands gives a handy method of counting elements that meet particular criteria. b <- c(7, 2, 4, 3, -1, -2, 3, 3, 6, 8, 12, 7, 3) b Let’s count the 3s in the vector…

## Quick start with R: Generalised Linear Model on binary data (Part 16)

In Part 15, we saw how to create a simple Generalised Linear Model on binary data using the glm() command. We continue with the same glm (modelling the vs variable on the weight and engine displacement) on the same data set – the mtcars dataset…

## Quick start with R: Generalised Linear Models (Part 15)

In Part 15, let’s see how to create simple Generalised Linear Models in R. Ordinary Least Squares regression provides linear models of continuous variables. However, much data of interest to statisticians and researchers are not continuous and so other methods must be used to create…