# NOT RUN {
library("data.table")
library("laeken")
data("ses")
dataset1 <- data.table(ID = paste0("V", 1 : nrow(ses)), ses)
dataset1[, IDnum := .I]
setnames(dataset1, "sex", "sexf")
dataset1[sexf == "male", sex:= 1]
dataset1[sexf == "female", sex:= 2]
# Full population
gpgs1 <- lingpg(Y = "earningsHour", gender = "sex",
id = "IDnum", weight = "weights",
dataset = dataset1)
gpgs1$value
# }
# NOT RUN {
# Domains by education
gpgs2 <- lingpg(Y = "earningsHour", gender = "sex",
id = "IDnum", weight = "weights",
Dom = "education", dataset = dataset1)
gpgs2$value
# Sort variable
gpgs3 <- lingpg(Y = "earningsHour", gender = "sex",
id = "IDnum", weight = "weights",
sort = "IDnum", Dom = "education",
dataset = dataset1)
gpgs3$value
# Two survey periods
dataset1[, year := 2010]
dataset2 <- copy(dataset1)
dataset2[, year := 2011]
dataset1 <- rbind(dataset1, dataset2)
gpgs4 <- lingpg(Y = "earningsHour", gender = "sex",
id = "IDnum", weight = "weights",
sort = "IDnum", Dom = "education",
period = "year", dataset = dataset1)
gpgs4$value
names(gpgs4$lin)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab