data(ses)
dati <- data.table(ID = 1 : nrow(ses), ses)
setnames(dati, "sex", "sexf")
dati[sexf == "male", sex:= 1]
dati[sexf == "female", sex:= 2]
# Full population
gpgs1 <- lingpg(Y = "earningsHour", gender = "sex",
id = "ID", weight = "weights",
dataset = dati)
gpgs1$value
## Not run:
# # Domains by education
# gpgs2 <- lingpg(Y = "earningsHour", gender = "sex",
# id = "ID", weight = "weights",
# Dom = "education", dataset = dati)
# gpgs2$value
#
# # Sort variable
# gpgs3 <- lingpg(Y = "earningsHour", gender = "sex",
# id = "ID", weight = "weights",
# sort = "ID", Dom = "education",
# dataset = dati)
# gpgs3$value
#
# # Two survey periods
# dati[, year := 2010]
# dati2 <- copy(dati)
# dati2[, year := 2011]
# dati <- rbind(dati, dati2)
# gpgs4 <- lingpg(Y = "earningsHour", gender = "sex",
# id = "ID", weight = "weights",
# sort = "ID", Dom = "education",
# period = "year", dataset = dati)
# gpgs4$value
# names(gpgs4$lin)
# ## End(Not run)
Run the code above in your browser using DataLab