poly_melt: Melt a polynomial matrix

View source: R/polypoly-package.R

poly_meltR 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)

polypoly documentation built on Oct. 20, 2022, 9:05 a.m.