Very Basic: Keep getting "Object not found" error

Very new to R and having trouble running through a basic practice case. Following this guide: Chapter 2 Data Visualization | Statistical Inference via Data Science, trying to filter the flights dataset within nycflights13 package, but using any variable in the dataset, I keep getting the same object not found error

Is my dataset improperly loaded?

carrier, not corrier

This is happening because you have forgotten to load the dplyr package (base R filter() function has a different syntax), if I load dplyr everything works as expected.

library(nycflights13)
library(dplyr)

flights %>% 
    filter(carrier == "AS")
#> # A tibble: 714 x 19
#>     year month   day dep_time sched_dep_time dep_delay arr_time sched_arr_time
#>    <int> <int> <int>    <int>          <int>     <dbl>    <int>          <int>
#>  1  2013     1     1      724            725        -1     1020           1030
#>  2  2013     1     1     1808           1815        -7     2111           2130
#>  3  2013     1     2      722            725        -3      949           1030
#>  4  2013     1     2     1818           1815         3     2131           2130
#>  5  2013     1     3      724            725        -1     1012           1030
#>  6  2013     1     3     1817           1815         2     2121           2130
#>  7  2013     1     4      725            725         0     1031           1030
#>  8  2013     1     4     1808           1815        -7     2101           2130
#>  9  2013     1     5      725            725         0     1011           1030
#> 10  2013     1     5     1803           1815       -12     2118           2130
#> # … with 704 more rows, and 11 more variables: arr_delay <dbl>, carrier <chr>,
#> #   flight <int>, tailnum <chr>, origin <chr>, dest <chr>, air_time <dbl>,
#> #   distance <dbl>, hour <dbl>, minute <dbl>, time_hour <dttm>

Created on 2020-10-30 by the reprex package (v0.3.0)

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.