formula.tools: Utilities for Formulas, Expressions, Calls and Other Objects

モデル式オブジェクトなどのためのユーティリティ

> library(formula.tools)
Loading required package: operator.tools
operator.tools-1.6.3 - Copyright © 2017 Decision Patterns
formula.tools-1.6.1 - Copyright © 2017 Decision Patterns

バージョン: 1.6.1


関数名 概略
.invert.single Invert multiple elements of a multiple element object
.is.one.sided Determine if an object is one- or two- sided.
as.character.formula Converts a formula to character
formula.parts Manipulate the component parts of formulas, expressions, calls, name/symbols and list and vectors of such objects.
get.vars Get variable (names) from various R objects
invert invert
is.cat Work with variables as categorical or continuous
op.type Get the operator type used in an call, formula, expression, etc.
terms.call terms

as.character.formula

モデル式を文字列に変換

> as.character( y ~ mx +  b )
[1] "y ~ mx + b"

get.vars

モデル式で使われている変数名を取得

> get.vars( Species ~ ., iris )
[1] "Species"      "Sepal.Length" "Sepal.Width"  "Petal.Length"
[5] "Petal.Width"