Homework Help for Beginner

Hi, this is my first time ever coding and I'm having a hard time understanding why the code I wrote is telling me that there is an error. Any help would be appreciated. Thanks.

`

There is a function called df. If you start with a fresh R session and try to execute

df$Female

you will get the error because $ is used to subset a data frame and you cannot get a subset of a function. However, you have defined a data frame named df, so df$Female should work. Is it possible that you deleted the data frame named df? If you run

ls()

you will see all of the objects you have created. Is df among them?

Alternative:

df |>
    group_by(Female) |>
    summarise(count = n())