Skip to content

titanic_4 not working #10

@Darthpathos

Description

@Darthpathos

Good day
Further to others that have posted here, I am working on the titanic dataset problem #4 and am having the same issue, where the answer I have (from the titanic_4_corrected file here) is not being marked as Correct.

This is the code I am running:

titanic_4 <- titanic %>% 
    select(Survived, Pclass, Age, Sex) %>%
    filter(!is.na(Age)) %>%
    mutate(agecat = cut(Age, breaks = c(0, 14.99, 50, 150), 
                        include.lowest = TRUE,
    labels = c("Under 15", "15 to 50", "Over 50"))) %>%
    group_by(Pclass, agecat, Sex) %>%
    summarize(N = n(),
        survivors = sum(Survived == 1),
        perc_survived = 100 * survivors / N)

which I realized doesn't have the head(titanic_4) line at the end; however, I'm still not able to get it working and am completely stumped.
Any ideas would be appreciated.
Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions