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.
Examples
#> Loading required namespace: plm
#> Error in DONTSHOW({ if (!requireNamespace("plm")) { if (interactive() || is.na(Sys.getenv("_R_CHECK_PACKAGE_NAME_", NA))) { stop("package 'plm' is required for this example") } else { q() } }}): package 'plm' is required for this example
data("LaborSupply", package = "plm")
#> Error in find.package(package, lib.loc, verbose = verbose): there is no package called ‘plm’
nrow(LaborSupply)
#> Error: object 'LaborSupply' not found
unique(LaborSupply$year)
#> Error: object 'LaborSupply' not found
ss <- subsample(LaborSupply, "id", "year", nkeep = 100)
#> Error: object 'LaborSupply' not found
nrow(ss)
#> Error: object 'ss' not found
