Selecting Columns with select() in R
📖 Scenario: You have a small table of fruit sales data. You want to look at only some columns to understand the sales better.
🎯 Goal: Learn how to use the select() function from the dplyr package in R to pick specific columns from a data frame.
📋 What You'll Learn
Create a data frame called
fruit_sales with exact columns and valuesCreate a vector called
columns_to_select with exact column namesUse
select() with fruit_sales and columns_to_select to create a new data framePrint the new data frame
💡 Why This Matters
🌍 Real World
Selecting specific columns from data is common when you want to focus on important information and ignore the rest.
💼 Career
Data analysts and scientists often use select() to prepare data for reports, charts, or further analysis.
Progress0 / 4 steps