i'm having trouble printing out the names in the for loop. This is what I have. I'm trying to print the names of the passengers who are the ages of less or equal to 14.
x <- c()
for(i in length(titanicDataset$name)){
if(titanicDataset$age[i] <= 14){
x[i] <- titanicDataset$name[i]
}
}
print(x)
it just prints NULL
Aucun commentaire:
Enregistrer un commentaire