# dati library(carData) data(SLID) # INDICIZZAZIONE str(SLID[1]) str(SLID[1:10,]) # table(SLID["language"]) # table(SLID[,"language"]) table(SLID$language) table(SLID[SLID$age<66,"language"]) table(SLID[SLID$age<66 & SLID$language!="Other", c(5,4)]) # ARGOMENTO SUBSET t.test(wages~sex, alternative='two.sided', conf.level=.95, data=SLID, subset = SLID$age<66) # FUNZIONE SUBSET # subset con tutte le variabili newdata <- subset(SLID, language == "English") # subset con alcune variabili (ID e Weight) newdata <- subset(SLID, age > 24 | age < 65, select=c(ID, Weight))