Learn R Programming

xtsum (version 0.1.0)

within_max: Compute the maximum within-group for a panel data

Description

This function computes the maximum within-group for a panel data.

Usage

within_max(data, variable, id = NULL, t = NULL, na.rm = FALSE)

Value

The maximum within-group effect.

Arguments

data

A data.frame or pdata.frame object containing the panel data.

variable

The variable for which the maximum within-group effect is calculated.

id

(Optional) Name of the individual identifier variable.

t

(Optional) Name of the time identifier variable.

na.rm

Logical. Should missing values be removed? Default is FALSE.

Examples

Run this code
# Example using pdata.frame
data("Gasoline", package = "plm")
Gas <- pdata.frame(Gasoline, index = c("country", "year"), drop.index = TRUE)
within_max(Gas, variable = "lgaspcar")


# Using regular data.frame with id and t specified
data("Crime", package = "plm")
within_max(Crime, variable = "crmrte", id = "county", t = "year")

Run the code above in your browser using DataLab