Question
R Programming SQL PLEASE HELP In order to answer these questions you will need to load up the mdsr package and RMySQL package, as we
R Programming SQL PLEASE HELP
In order to answer these questions you will need to load up the mdsr package and RMySQL package, as we did in class. Once you pull in the query you may use the data wrangling verbs we have developed to answer the following questions.
Connect to the airlines database. Make a list of all of the tables in this database. List the names of all of the variables in the flights table.
Do a query to generate a data frame that represents the number of flights that flew from Minneapolis/St. Paul (MSP) on June 12, 2015. How many of those flights flew to Denver (DEN)? (Be sure to not include any canceled flights.)
Do a query to generate a data frame that represents all the flights that flew from Minneapolis/St. Paul in 2010.
Using the data frame from Exercise 3, what were the top 6 destinations for flights from Minneapolis/St. Paul in 2010?
Using the data frame from Exercise 3, from flights that flew from Minneapolis/St. Paul in 2010, which 5 airports had the highest average arrival delay time?
****THIS IS WHAT WE DID IN CLASS******
library(mdsr) library(RMySQL) # Connect to the server and the database airlines db <- dbConnect_scidb(dbname ="airlines") # Connect to the specific dataframes flights <- tbl(db, "flights") class(flights) # Emphasize this is not a data frame - the data still live on the sql server. carriers <- tbl(db, "carriers") show_query(carriers) # This code shows the SQL language syntax to pull the query
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started