Create a Data Frame

appetizer
create data frame
none spicy
Author

Ryan Garnett

Published

March 29, 2023

Description
Create a dataframe object in memory that has multiple character and numeric columns
Ingredients
Package Data
NA NA


Sample Instructions

dataframe_name <- data.frame(first_column_name = c(number, number, number, number),
                             second_column_name = c("text", "text", "text", "text"),
                             third_column_name = c(number, number, number, number),
                             forth_column_name = c(number, number, number, number)
                             )


Actual Instructions

atlantic_capital_temperatures <- data.frame(station_id = c(100, 101, 102, 103),
                                            province = c("NL", "NS", "PE", "NB"),
                                            city = c("St John's", "Halifax", "Charlottetown", "Saint John"),
                                            temperature = c(10, 15.1, 6.3, -4.3)
                                            )


Output

station_id province city temperature
100 NL St John's 10.0
101 NS Halifax 15.1
102 PE Charlottetown 6.3
103 NB Saint John -4.3