Is There A Neat/Simplest Way To This data.table R Code?
问题 The STRATUM from OECD data is so long, for simplicity I put this name and would like to simplified it to a more short and precise naming as in the code below. pisaMas[,`:=` (SchoolType = c(ifelse(STRATUM == "National Secondary School", "Public", ifelse(STRATUM == "Religious School", "Religious", ifelse(STRATUM == "MOE Technical School", "Technical",0)))))] pisaMas[,table(SchoolType)] I would like to know if there are a simple way to this problems, using data.table package. 回答1: Current