Modérateur : Groupe des modérateurs
Code : Tout sélectionner
tab_EU=tab[tab$pays=='EU',]
Code : Tout sélectionner
tab_NEU=tab[tab$pays=='NEU',]
#equivalent à:
tab_NEU=tab[tab$pays!='EU',]
Code : Tout sélectionner
censusA=split(census, census$country)
Code : Tout sélectionner
lapply(censusA, summary)
Code : Tout sélectionner
pays <- sample(c("US","FRA","ESP","BRE"),20,rep=T)
pays
[1] "US" "ESP" "US" "ESP" "FRA" "BRE" "US" "BRE" "US" "BRE" "FRA" "BRE" "BRE" "FRA" "FRA" "BRE" "ESP" "ESP" "FRA" "FRA"
fac <- as.factor(ifelse(pays=="US","US","other"))
fac
US other US other other other US other US other other other other other other other other other other other
# pour vérifier que ça marche :
table(pays,fac)
fac
pays other US
BRE 6 0
ESP 4 0
FRA 6 0
US 0 4
Retourner vers « Questions en cours »
Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 1 invité