statar (version 0.2)

demean: Demean a vector

Description

Demean a vector

Usage

demean(x, fe)

Arguments

x
A vector, a list of vector, or a data.frame
fe
List of vectors for group (factor, characters or integers)

Value

  • A demeaned vector

    An object of the same type than `x` (ie vector, list or data.frame) where each vector is replaced by its demaned version.

Details

This function calls felm::demeanlist after dealing with missing values and converting group variables into factors

Examples

Run this code
#demean(c(1,2), fe = c(1L,1L))
#demean(c(NA,2), fe = list(c(1L,2L), c(1L,3L)))
#demean(c(1,2), fe = list(c(NA,2L), c(1L,3L)))
#demean(list(c(1,2),c(1,4)), fe = list(c(NA,2L), c(1L,3L)))

Run the code above in your browser using DataLab