|
25 | 25 | #' resulting \code{data.table}. the variable \code{pid} is the unique person identifier, constructed from ID1968 and pernum
|
26 | 26 | #' @export
|
27 | 27 | #' @examples
|
28 |
| -#' \dontrun{ |
29 |
| -#' # ################################################ |
30 |
| -#' # Real-world example: not tested during |
31 |
| -#' # R CMD CHECK it because takes long. |
32 |
| -#' # Build panel with income, wage, age and education |
33 |
| -#' # optionally: add wealth supplements! |
34 |
| -#' # ################################################ |
35 |
| -#' |
36 |
| -#' # The package is installed with a list of variables |
37 |
| -#' # Alternatively, search for names with \code{\link{getNamesPSID}} |
38 |
| -#' # This is the body of function build.psid() |
39 |
| -#' r = system.file(package="psidR") |
40 |
| -#' if (small){ |
41 |
| -#' f = fread(file.path(r,"psid-lists","famvars-small.txt")) |
42 |
| -#' i = fread(file.path(r,"psid-lists","indvars-small.txt")) |
43 |
| -#' } else { |
44 |
| -#' f = fread(file.path(r,"psid-lists","famvars.txt")) |
45 |
| -#' i = fread(file.path(r,"psid-lists","indvars.txt")) |
46 |
| -#' } |
47 |
| -#' setkey(i,"name") |
48 |
| -#' setkey(f,"name") |
49 |
| -#' i = dcast(i[,list(year,name,variable)],year~name) |
50 |
| -#' f = dcast(f[,list(year,name,variable)],year~name) |
51 |
| -#' # executing this function will download data. takes long. |
52 |
| -#' d = build.panel(datadir="~/datasets/psid/",fam.vars=f, |
53 |
| -#' ind.vars=i, |
54 |
| -#' heads.only =TRUE,sample="SRC", |
55 |
| -#' design="all") |
56 |
| -#' } |
57 | 28 | #'
|
58 | 29 | #' # ######################################
|
59 | 30 | #' # reproducible example on artifical data.
|
|
0 commit comments