dvnames function

Title models with their dependent variables

Title models with their dependent variables

A convenience function for use with a regression model or list of regression models. Returns a named list of models, where the names are the models' respective dependent variables. Pass your list of models to dvnames before sending to modelsummary to automatically get dependent variable-titled columns.

dvnames(models, number = FALSE, strip = FALSE, fill = "Model")

Arguments

  • models: A regression model or list of regression models
  • number: Should the models be numbered (1), (2), etc., in addition to their dependent variable names?
  • strip: boolean FALSE returns the dependent variable names as they appear in the model. TRUE returns the dependent variable names as they appear in the data, without transformations.
  • fill: If insight::find_response() cannot find a response, the column title to use in its place. Set to ' ' to leave blank.

Examples

m1 <- lm(mpg ~ hp, data = mtcars) m2 <- lm(mpg ~ hp + wt, data = mtcars) # Without dvnames, column names are (1) and (2) modelsummary(list(m1, m2)) # With dvnames, they are "mpg" and "mpg" modelsummary(dvnames(list(m1,m2)))
  • Maintainer: Vincent Arel-Bundock
  • License: GPL-3
  • Last published: 2025-02-02

Downloads (last 30 days):