# NOT RUN {
x <- as.polynomial(
c(1, NA, Inf, 6, 4, 3, 0, 1, 9),
c(5, 7, 4, 4, 5, 8, 2, 3, 8)
)
reduce(x) # 0 valued coefficient is removed
reduce(x, zero.rm = FALSE) # 0 valued coefficient is not removed
reduce(x, na.rm = TRUE) # missing valued coefficient is removed
reduce(x, finite = TRUE) # non-finite valued coefficients are removed
## 'dflt.exp = NA' means that 'reduce' will decide whether the coefficients
## should be rearranged such that the exponents take on their default values.
## In this case, it decides 'dflt.exp = TRUE'
reduce(x, dflt.exp = NA)
reduce(x, dflt.exp = TRUE) # exponents take on their default values (forced)
## coefficients corresponding to duplicate exponents are summed
reduce(x, fix.dup.exp = TRUE)
reduce(x, decreasing = FALSE) # increasing exponents
reduce(x, decreasing = TRUE) # decreasing exponents
# }
Run the code above in your browser using DataLab