0
0
R Programmingprogramming~15 mins

Numeric type in R Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
Working with Numeric Types in R
📖 Scenario: You are helping a small business owner track daily sales amounts. The sales amounts are numbers that include decimals.
🎯 Goal: You will create a numeric vector of sales amounts, set a threshold value, filter sales above the threshold, and print the filtered sales.
📋 What You'll Learn
Create a numeric vector with exact sales amounts
Create a numeric threshold variable
Use a logical condition to filter sales above the threshold
Print the filtered sales vector
💡 Why This Matters
🌍 Real World
Tracking and analyzing sales amounts helps businesses understand their performance and make decisions.
💼 Career
Data analysts and business managers often work with numeric data to filter and summarize important information.
Progress0 / 4 steps
1
Create the sales data vector
Create a numeric vector called sales with these exact values: 23.5, 45.0, 12.75, 67.25, and 34.0.
R Programming
Need a hint?

Use the c() function to create a numeric vector with the exact numbers.

2
Set the sales threshold
Create a numeric variable called threshold and set it to 30.
R Programming
Need a hint?

Assign the number 30 to the variable threshold using the assignment operator <-.

3
Filter sales above the threshold
Create a new vector called high_sales that contains only the values from sales that are greater than threshold.
R Programming
Need a hint?

Use logical indexing with sales > threshold inside square brackets to filter the vector.

4
Print the filtered sales
Print the high_sales vector to display the sales amounts greater than the threshold.
R Programming
Need a hint?

Use the print() function to display the vector.