Using Logical Operators in R
📖 Scenario: You are working with a small dataset of students' test scores. You want to find out which students passed based on certain conditions using logical operators.
🎯 Goal: Build a simple R program that uses logical operators &, |, and ! to check students' scores and print who passed.
📋 What You'll Learn
Create a named vector called
scores with exact student names and scoresCreate a variable called
pass_mark with the value 60Use logical operators
&, |, and ! to find students who passed or failedPrint the final result showing which students passed
💡 Why This Matters
🌍 Real World
Logical operators help filter and select data based on conditions, useful in data analysis and decision making.
💼 Career
Understanding logical operators is essential for data scientists, analysts, and programmers to write conditions and control program flow.
Progress0 / 4 steps