In 3rd line, "life_expec_filter %>%" has to be defined again?

Screen Link:

My Code:
life_expec_filter <- life_expec >
filter(Race == “All Races” & Sex == “Both Sexes”)
ggplot(aes(x = Year, y = Avg_Life_Expec)) +
geom_line() +
labs(
title = “United States Life Expectancy: 100 Years of Change”,
y = “Average Life Expectancy (Years)”
) +
theme(
panel.background = element_rect(fill = “white”)
)

Replace this line with your code

What I expected to happen:
Error: data must be a data frame, or other object coercible by fortify(), not an S3 object with class uneval
Did you accidentally pass aes() to the data argument?
Traceback:

  1. ggplot(aes(x = Year, y = Avg_Life_Expec))
  2. as.environment(“package:ggplot2”)$ggplot(…)
  3. ggplot.default(…)
  4. fortify(data, …)
  5. fortify.default(data, …)
  6. abort(msg)
  7. signal_abort(cnd)

What actually happened:

Replace this line with the output/error

I’m not sure why I have to redefine "life_expec_filter >" after the 1st line.

Hi @nextlevellearning123

Please update your question with a mission link and formatted code. That enables community to help better.

Hi I am not sure what you want me to do.
Could you please be more specific on that?

hi @nextlevellearning123

I meant something like this, the mission link you are learning from and the formatted code:

You can find more details here - Guidelines for asking a technical questions in our Community

This is my link.

Thanks in advance.

I haven’t done this mission. So I am not entirely sure here.

I commented the filter code and executed the solution code and it runs fine, so I guess, it’s a just a helping code from the author so that we are in the learning flow - that is to say,
just a quickie that we did this (the filter code) in the last step and the current task is in continuation.

Sometimes authors do mention it in the content, sometimes they add a comment to the console. Maybe it got skipped here. In case, you want to experiment with commenting this part, and then try your code you may do that, or you can raise a ticket to provide your comments as feedback to DQ.

I may be completely wrong here, but it might serve as a reference point rather than a required part of the code.