'nycflights13' package is not found

Hello. I'm new to R and learning using "R for Data Science" online book http://r4ds.had.co.nz/transform.html#introduction-2 . In Section 5.1 on how to use dplyr packages, I am having a similar issue where the 'nycflights13' package is not found. Have updated, restarted, etc. but no luck. Any help is appreciated.

Did you install it? You can install it with install.packages().

1 Like

I guess I assumed it would be there like all the previous packages (mpg, diamonds, etc.). install.package per your suggestion seems to have done it. Thank you. Guess that's a mulligan.

1 Like

These distinctions definitely aren’t super obvious when you’re just starting out! diamonds and mpg are two of the example datasets that come bundled with the ggplot2 package. As you just discovered, nycflights13 is an entire package itself (that contains several tables of related data).

1 Like

Indeed.

A good trick vikg, if you aren't sure, is to google "r package-name" :slight_smile: If the package is on CRAN, you will find the manual:

https://cran.r-project.org/web/packages/nycflights13/index.html

1 Like

HI i am facing a similar problem with nycflights13
I used install.packages ()
and the console gave me

install.packages("nycflights13")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/nycflights13_1.0.0.tgz'
Content type 'application/x-gzip' length 7115849 bytes (6.8 MB)

downloaded 6.8 MB
The downloaded binary packages are in
/var/folders/43/0gc8bljx4mn7q94zh3dw47dw0000gn/T//Rtmpim3yKa/downloaded_packages

i cant seem to be able to load it from the library even though i can see it there.

library(nycflights13)
print(nycflights13)
Error in print(nycflights13) : object 'nycflights13' not found

Tried restarting and updating r and r studio both. Please help

You can't print() a library, maybe you are trying to print a dataframe contained in that library, like this.

print(nycflights13::flights)
#> # A tibble: 336,776 x 19
#>     year month   day dep_time sched_dep_time dep_delay arr_time
#>    <int> <int> <int>    <int>          <int>     <dbl>    <int>
#>  1  2013     1     1      517            515         2      830
#>  2  2013     1     1      533            529         4      850
#>  3  2013     1     1      542            540         2      923
#>  4  2013     1     1      544            545        -1     1004
#>  5  2013     1     1      554            600        -6      812
#>  6  2013     1     1      554            558        -4      740
#>  7  2013     1     1      555            600        -5      913
#>  8  2013     1     1      557            600        -3      709
#>  9  2013     1     1      557            600        -3      838
#> 10  2013     1     1      558            600        -2      753
#> # … with 336,766 more rows, and 12 more variables: sched_arr_time <int>,
#> #   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 2019-06-21 by the reprex package (v0.2.1)

1 Like