Museums and Nature Centers - stuck on task 6 DPLYR filter()

Hello, I am stuck on task 6 here below:
Museums exercise link

It says:

Filter data frame to select states

museums_states ← museums_df %>%
filter(State…Administrative.Location. == “IL” | State…Administrative.Location. == “CA” | State…Administrative.Location. == “NY”)
head(museums_states)

Can someone explain why this isn’t working? Thanks!!

This looks like R, about which I know nothing, but since this topic has sat in limbo for several hours, I cannot resist at least talking about it.

If it is safe to assume that a ← b is an assignment,

state ← State…Administrative.Location.

would seem like a no-brainer, just for the sake of simplicity. That whole description just became a simple identifier.

Again, without knowing anything, one would expect this language to have some form of membership test. For example below I’ll use Python:

if state in ['IL', 'CA', 'NY']:
    # do something

or in string form,

if state in 'ILCANY':
    # do something

That would eliminate all the OR logic.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.