my_spread: Transform a dataframe from long to wide

Description Usage Arguments Value Examples

Description

Transform a dataframe from long to wide

Usage

1
my_spread(data, keycol, valcol)

Arguments

data

A data frame

keycol

Name of column whose content will be the names of the new columns, a string

valcol

Name of column whose content will be the values of the new columns, a sting

Value

A data frame

Examples

1
2
df <- data.frame(Name = c("A","B"), key = c("Age","Weight"), value = c(45,80))
my_spread(df,"key","value")

UBC-MDS/miniTidyR documentation built on May 7, 2019, 7:14 p.m.