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:
DataFrames
: For working with tabular data.CSV
: For reading CSV files.HTTP
: For downloading data from the web.size(flights)
returns a tuple containing the number of
rows and columns of the DataFrame.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:
DataFrames
: For working with tabular data.CSV
: For reading CSV files.HTTP
: For downloading data from the web.names(flights)
returns an array containing the names of
all columns in the DataFrame.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.