poly_melt {polypoly}R Documentation

Melt a polynomial matrix

Description

Melt a polynomial matrix

Usage

poly_melt(x)

Arguments

x

a matrix created by stats::poly()

Details

The degree values are returned as a character vector because they should be treated categorically (as when plotting). Moreover, matrices made with multiple vectors (e.g., poly(rnorm(10), rnorm(10), degree = 2)) have names that are not numerically meaningful (e.g., 1.0, 2.0, 0.1, 1.1, 0.2),

Value

a tibble::tibble() with three columns: observation (row number of the matrix), polynomial degree, and value.

Examples

m <- poly(rnorm(10), degree = 3)
poly_melt(m)

[Package polypoly version 0.0.3 Index]