subsample | R Documentation |
returns a subsample of a panel data set; in particular drops
all observations that are not in keepids
. If it is not set,
randomly keeps nkeep
observations.
subsample(dta, idname, tname, keepids = NULL, nkeep = NULL)
dta |
a data.frame which is a balanced panel |
idname |
the name of the id variable |
tname |
the name of the time variable |
keepids |
which ids to keep |
nkeep |
how many ids to keep (only used if |
a data.frame that contains a subsample of dta
data("LaborSupply", package = "plm")
nrow(LaborSupply)
unique(LaborSupply$year)
ss <- subsample(LaborSupply, "id", "year", nkeep = 100)
nrow(ss)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.