nycflights13 - difficulty downloading

There seems to be an ongoing issue with downloading this package in R Studio.

This is where I am up to so far:

library(nycflights13)
Error in library(nycflights13) :
there is no package called ‘nycflights13’
install(nycflights13)
Error in install(nycflights13) : could not find function "install"
nycflights::flights
Error in loadNamespace(x) : there is no package called ‘nycflights’
nycflights13::flights
Error in loadNamespace(x) : there is no package called ‘nycflights13’
?flights
No documentation for ‘flights’ in specified packages and libraries:
you could try ‘??flights’
??flights
library (nycflights13)
Error in library(nycflights13) :
there is no package called ‘nycflights13’
library(dplyr)
library (nycflights13)
Error in library(nycflights13) :
there is no package called ‘nycflights13’
install.packages(nycflights13)
Error in install.packages : object 'nycflights13' not found
install.packages("nycflights13")
trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/nycflights13_1.0.2.tgz'
Content type 'application/x-gzip' length 4503212 bytes (4.3 MB)
==================================================
downloaded 4.3 MB

The downloaded binary packages are in
/var/folders/wf/4yj99mh16yz81l_681f6hzn00000gn/T//Rtmp8dV6GQ/downloaded_packages

?nycflights
No documentation for ‘nycflights’ in specified packages and libraries:
you could try ‘??nycflights’
??flights
nycflights13::flights

A tibble: 336,776 × 19

year month   day dep_time sched_dep_time dep_delay arr_time sched_arr_time


1 2013 1 1 517 515 2 830 819
2 2013 1 1 533 529 4 850 830
3 2013 1 1 542 540 2 923 850
4 2013 1 1 544 545 -1 1004 1022
5 2013 1 1 554 600 -6 812 837
6 2013 1 1 554 558 -4 740 728
7 2013 1 1 555 600 -5 913 854
8 2013 1 1 557 600 -3 709 723
9 2013 1 1 557 600 -3 838 846
10 2013 1 1 558 600 -2 753 745

:information_source: 336,766 more rows

:information_source: 11 more variables: arr_delay , carrier , flight ,

tailnum , origin , dest , air_time , distance ,

hour , minute , time_hour

:information_source: Use print(n = ...) to see more rows

install.packages("nycflights13")
Error in install.packages : Updating loaded packages

Restarting R session...

install.packages("nycflights13")
trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/nycflights13_1.0.2.tgz'
Content type 'application/x-gzip' length 4503212 bytes (4.3 MB)
==================================================
downloaded 4.3 MB

The downloaded binary packages are in
/var/folders/wf/4yj99mh16yz81l_681f6hzn00000gn/T//Rtmpa3VEtV/downloaded_packages

view (nycflights13)
Error in view(nycflights13) : could not find function "view"
view (nycflights13)
Error in view(nycflights13) : could not find function "view"
View (nycflights13)
Error in View : object 'nycflights13' not found

I have seen a number of solutions - hence the Tibble above - but still can't download the data to practice on.

Any help gratefully received.

Try

 install.packages("nycflights13") 

Thank you.

Got this:

install.packages("nycflights13")
trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/nycflights13_1.0.2.tgz'
Content type 'application/x-gzip' length 4503212 bytes (4.3 MB)
==================================================
downloaded 4.3 MB

The downloaded binary packages are in
/var/folders/wf/4yj99mh16yz81l_681f6hzn00000gn/T//Rtmpa3VEtV/downloaded_packages

Where do I go from here the View command yields no joy.

{nycflights13} is a library of files not a single file. (Yes it is confusing).

Data sets in package ‘nycflights13’:

files files
airlines Airline names
airports Airport metadata
flights Flights data
planes Plane metadata
weather Hourly weather data

You can just do

airlines

or

view(airlines)

Do

data()

and you will see the various data sets currently available to you. You will need to scroll down a bit to get to the {nycflights13} files.

jrkrideau

Much thanks for your help.

Finally got to this point:

airlines
Error: object 'airlines' not found
View(airlines)
Error in View : object 'airlines' not found
data()
data(package="nycflights13")
View(airlines)
Error in View : object 'airlines' not found
nycflights13::flights

A tibble: 336,776 × 19

year month   day dep_time sched_dep_time


1 2013 1 1 517 515
2 2013 1 1 533 529
3 2013 1 1 542 540
4 2013 1 1 544 545
5 2013 1 1 554 600
6 2013 1 1 554 558
7 2013 1 1 555 600
8 2013 1 1 557 600
9 2013 1 1 557 600
10 2013 1 1 558 600

:information_source: 336,766 more rows

:information_source: 14 more variables: dep_delay ,

arr_time , sched_arr_time ,

arr_delay , carrier ,

flight , tailnum , origin ,

dest , air_time , distance ,

hour , minute , …

:information_source: Use print(n = ...) to see more rows

I am guessing that the size of the data set is the reason that the View command does not work?

JamesT

Does saying library(nycflights13) first fix things?

Hi startz

Even though I got the Tibble - seems I didn't get the data.

Will try your suggestion and see what happens.

JamesT

Hi startz

Kerpow!

library(nycflights13)
View(nycflights13)
Error in View : object 'nycflights13' not found
View(flights)

...and up came the data set.

Sad I know, but loving this. My brain was turned to mush by SPSS - this is the cure.

Trying to just reset (very) old skills by working through https://r4ds.hadley.nz/

Thanks for your help.

JamesT

1 Like

I suspect @ startz has it. You probably did not load {nycflights13}.

This code should work:

library(tidyverse)
library(nycflights13)
str(airlines)
view(airlines)
#===========and=========
str(flights)
view(flights)

I'm working on a fairly lightweight laptop so the view(flights) is taking 8.29 sec to load the file but it is working fine.

In response to your comment to startz you are getting the flight tibble because your command

nycflights13::flights

in telling R to go to the library and grab flights without loading the entire library.

Something like view(flights) assumes that you have the library already loaded.

I had never really thought about it but without {nycflights13} being loaded, this works. It just takes ≈ 2 seconds longer.

view(nycflights13::flights)

This topic was automatically closed 90 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.