ticket.first.char <- ifelse(data.combined$ticket == "", " ", substr(data.combined$ticket, 1, 1))
data.combined$ticket <- as.factor(ticket.first.char)
#> It has 16 levels as it supposed to define a ticket class by its unique first character:
levels(factor(data.combined$ticket))
[1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "C" "F" "L" "P" "S" "W"
#> __________________________________________________________
> ggplot(data.combined[1:891,], aes(x = ticket.first.char)) +
+ geom_bar() +
+ ggtitle("Survivability by ticket.first.char") +
+ xlab("ticket.first.char") +
+ ylab("Total Count") +
+ ylim(0,350) +
+ labs(fill = "Survived")
#> The code displayed above is receiving the following error message
Error: Aesthetics must be either length 1 or the same as the data (891): x