Learn R Programming

insight (version 0.18.6)

find_response: Find name of the response variable

Description

Returns the name(s) of the response variable(s) from a model object.

Usage

find_response(x, combine = TRUE, ...)

Value

The name(s) of the response variable(s) from x as character vector, or NULL if response variable could not be found.

Arguments

x

A fitted model.

combine

Logical, if TRUE and the response is a matrix-column, the name of the response matches the notation in formula, and would for instance also contain patterns like "cbind(...)". Else, the original variable names from the matrix-column are returned. See 'Examples'.

...

Currently not used.

Examples

Run this code
if (require("lme4")) {
  data(cbpp)
  cbpp$trials <- cbpp$size - cbpp$incidence
  m <- glm(cbind(incidence, trials) ~ period, data = cbpp, family = binomial)

  find_response(m, combine = TRUE)
  find_response(m, combine = FALSE)
}

Run the code above in your browser using DataLab