Learn R Programming

pivot (version 18.4.17)

sql_unpivot: Create an unpivot query

Description

Creates a SQL pivot query. Similar to the tidyr::gather function.

Usage

sql_unpivot(con, from, select, key, value, levels, order_by = NULL)

Arguments

con

a Database connection

from

the from clause

select

variables to select in addition to levels.

key

Variable columns originate from

value

The expression to evaluate to create the values

levels

the columns to turn into values of a variable.

order_by

optional order by clause