The NYC Flights 13 dataset in R is a popular resource for data analysis. It contains comprehensive information about all domestic flights departing from New York City airports (JFK, LGA, EWR) during the year 2013.

Key Features:

Common Uses:

The NYC Flights 13 dataset provides a valuable resource for learning and applying data analysis skills in R.

using DataFrames, CSV, HTTP

# Download the NYC Flights 13 data from GitHub
url = "https://raw.githubusercontent.com/tidyverse/nycflights13/master/data-raw/nycflights13.csv"
response = HTTP.get(url)
data = String(response.body)

# Read the data into a DataFrame
flights = CSV.read(IOBuffer(data), DataFrame)

# Inspect the dimensions of the dataset
num_rows, num_cols = size(flights) 
println("Number of rows:", num_rows)
println("Number of columns:", num_cols)

Explanation:

  1. Import necessary packages:
    • DataFrames: For working with tabular data.
    • CSV: For reading CSV files.
    • HTTP: For downloading data from the web.
  2. Download and load the data:
    • The code downloads the NYC Flights 13 data from GitHub and reads it into a DataFrame.
  3. Inspect dimensions:
    • size(flights) returns a tuple containing the number of rows and columns of the DataFrame.
    • The code extracts the number of rows and columns from the tuple and prints them to the console.

This will output the number of rows and columns in the NYC Flights 13 dataset.

using DataFrames, CSV, HTTP

# Download the NYC Flights 13 data from GitHub
url = "https://raw.githubusercontent.com/tidyverse/nycflights13/master/data-raw/nycflights13.csv"
response = HTTP.get(url)
data = String(response.body)

# Read the data into a DataFrame
flights = CSV.read(IOBuffer(data), DataFrame)

# Get column names
column_names = names(flights) 

# Print column names
println("Column Names:")
for name in column_names
    println(name)
end

Explanation:

  1. Import necessary packages:
    • DataFrames: For working with tabular data.
    • CSV: For reading CSV files.
    • HTTP: For downloading data from the web.
  2. Download and load the data:
    • The code downloads the NYC Flights 13 data from GitHub and reads it into a DataFrame.
  3. Get column names:
    • names(flights) returns an array containing the names of all columns in the DataFrame.
  4. Print column names:
    • The code iterates through the column_names array and prints each column name to the console.

This will output a list of all column names in the NYC Flights 13 dataset.