Description Format Source Examples
This is just the demographic data for each person recorded in the wages data.
Number of subjects: 888; Number of variables: 6; Number of observations, across all subjects: 888
idid numbers for each subject
gedif a graduate equivalency diploma ever is obtained
blackcategorical indicator of race is black
hispaniccategorical indicator of race is hispanic
hgchighest grade completed
racecategorical variable, either white, hispanic or black
Singer, J. D. & Willett, J. B. (2003), Applied Longitudinal Data Analysis, Oxford University Press, Oxford, UK. It is a subset of data collected in the National Longitudinal Survey of Youth (NLSY) described at http://www.bls.gov/nls/nlsdata.htm.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | library(cranvas)
### (1) linking to between two tables, using common id variable
qwg <- qdata(wages.demog)
# qscatter(ged, race, data=qwg)
qbar(race, data = qwg)
qbar(ged, data = qwg)
qhist(hgc, data = qwg)
qwages <- qdata(wages)
qscatter(exper, lnw, data = qwages, alpha = 0.5)
id <- link_cat(qwages, var1 = "id", qwg, var2 = "id")
remove_link(qwages, id[1])
remove_link(qwg, id[2])
### (1.5) linking between two datasets, using several id variables
id <- link_cat(qwages, var1 = c("black", "hispanic"), qwg, var2 = c("black", "hispanic"))
qscatter(exper, lnw, data = qwages, alpha = 0.5)
qbar(black, data = qwg)
qbar(hispanic, data = qwg)
remove_link(qwages, id[1])
remove_link(qwg, id[2])
### (2) linking to oneself through a categorical variable
data(flea, package = "tourr")
qflea <- qdata(flea, color = species)
qhist(tars1, data = qflea) # an ordinary histogram; try brushing
## now we link qflea to itself by species
id <- link_cat(qflea, "species")
## brush the plot and see what happens
remove_link(qflea, id) # remove this linking; back to normal linking again
### (2.5) link to oneself by several categorical variables
idmulti <- link_cat(qwages, c("ged", "black", "hispanic"))
qscatter(exper, lnw, data = qwages, alpha = 0.5)
remove_link(qwages, idmulti)
### (3) link the original data with a frequency table
tab2 <- as.data.frame(table(flea$species))
colnames(tab2) <- c("type", "freq")
(qflea2 <- qdata(tab2))
head(qflea) # what the two datasets look like
## see how two different datasets can be linked through a common categorical
## variable
id <- link_cat(qflea, var1 = "species", qflea2, var2 = "type")
qhist(tars1, data = qflea)
qbar(type, data = qflea2, standardize = TRUE)
## remove the linking on two datasets respectively
remove_link(qflea, id[1])
remove_link(qflea2, id[2])
cranvas_off()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.