I keep getting the following error code on Task 9
filter rows
cars %>%
mpg_exceeds_threshold ← filter(mpg_diff_from_threshold > 0)
Error in filter(mpg_diff_from_threshold > 0): object ‘mpg_diff_from_threshold’ not found
Hide
mpg_exceeds_threshold
Error in eval(expr, envir, enclos): object ‘mpg_exceeds_threshold’ not found
Can someone look over what I am doing wrong?
title: “1985 Cars”
output: html-notebook
Task 1
# load libraries
library("readr")
library("dplyr")
Task 2
# load data
cars <- read.csv(file = 'cars85.csv')
Task 3
# inspect data
head(cars)
summary(cars)
Task 4
# select columns
cars <- cars %>%
select(-normalized_losses)
Task 5
# view columns
cars
Task 6
# rename column
cars %>%
rename(risk_factor = symboling)
Task 7
# define threshold
mpg_threshold <- 30
Task 8
# add column
cars %>%
mutate(mpg_diff_from_threshold = highway_mpg - mpg_threshold)
Task 9
# filter rows
cars %>%
mpg_exceeds_threshold <- filter(mpg_diff_from_threshold > 0)
mpg_exceeds_threshold
Thanks