poly2character: Convert a polynomial into character string

poly2characterR Documentation

Convert a polynomial into character string

Description

Differs from polynom::as.character.polynomial() in that trailing zeros are preserved.

Usage

poly2character(
  x,
  decreasing = getOption("ggpmisc.decreasing.poly.eq", FALSE),
  digits = 3,
  keep.zeros = TRUE
)

Arguments

x

a polynomial object.

decreasing

logical It specifies the order of the terms; in increasing (default) or decreasing powers.

digits

integer Giving the number of significant digits to use for printing.

keep.zeros

logical It indicates if zeros are to be retained in the formatted coefficients.

Value

A character string.

Note

This is an edit of the code in package 'polynom' so that trailing zeros are retained during the conversion. It is not defined using a different name so as not to interfere with the original.

Examples

poly2character(1:3)
poly2character(1:3, decreasing = TRUE)


ggpmisc documentation built on June 28, 2024, 1:07 a.m.