export_table: Export results to LaTeX or CSV

View source: R/utils.R

export_tableR Documentation

Export results to LaTeX or CSV

Description

Export results to LaTeX or CSV

Usage

export_table(object, file, format = "csv", equation = "both")

Arguments

object

An object of class "xtvfreg"

file

Character; output file name

format

Character; "latex" or "csv"

equation

Character; "mean", "variance", or "both"

Value

Invisibly returns NULL; called for side effects

Examples


# Create temporary file
set.seed(456)
n_id <- 30
n_time <- 4
panel_data <- data.frame(
  id = rep(1:n_id, each = n_time),
  group = rep(c("A", "B"), length.out = n_id * n_time),
  x = rnorm(n_id * n_time)
)
panel_data$m_x <- ave(panel_data$x, panel_data$id, FUN = mean)
panel_data$d_x <- panel_data$x - panel_data$m_x
panel_data$y <- 1 + panel_data$m_x + rnorm(n_id * n_time)

result <- xtvfreg(
  formula = y ~ 1,
  data = panel_data,
  group = "group",
  panel_id = "id",
  mean_vars = c("m_x", "d_x"),
  var_vars = "m_x",
  verbose = FALSE
)

# Export to CSV
temp_file <- tempfile(fileext = ".csv")
export_table(result, file = temp_file, format = "csv", equation = "mean")

# Clean up
unlink(temp_file)


xtvfreg documentation built on Nov. 27, 2025, 1:06 a.m.