Perform standard panel-data calculations
These functions perform the standard between and within transformations on panel data.
within_i( .var, .df = get(".", envir = parent.frame()), .fcn = function(x) mean(x, na.rm = TRUE), .i = NULL, .t = NULL, .uniqcheck = FALSE ) between_i( .var, .df = get(".", envir = parent.frame()), .fcn = function(x) mean(x, na.rm = TRUE), .i = NULL, .t = NULL, .uniqcheck = FALSE )
.var |
Vector to be transformed |
.df |
Data frame, pibble, or tibble (usually the data frame or tibble that contains |
.fcn |
The function to be passed to |
.i |
Quoted or unquoted variable(s) that identify the individual cases. Note that setting any one of |
.t |
Quoted or unquoted variable with the single variable name indicating the time. |
.uniqcheck |
Logical parameter. Set to TRUE to always check whether |
These functions do not take a .d
argument because it is irrelevant here.
data(SPrail) # Calculate within- and between-route variation in price and add it to the data SPrail <- SPrail %>% dplyr::mutate( within_route = within_i(price, .i = c(origin, destination)), between_route = between_i(price, .i = c(origin, destination)) )
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.