Saturday, March 28, 2026

Basic Understanding of R (For Beginners)

 

1. What is R?

R is a programming language used for data analysis, statistics, and visualization.

👉 In simple terms:
R = a tool for working with data and making sense of numbers

2. Why Learn R?

R is:

  • Widely used in data science and research
  • Great for statistics and analysis
  • Powerful for graphs and reports
  • Used in academics, finance, healthcare, and research

3. What Can R Be Used For?


R is used for:

  • Data analysis
  • Statistical modeling
  • Creating charts and graphs
  • Research and academic work
  • Business data insights

4. Installing R

To get started:

  • Download R from R (programming language) official website
  • Install RStudio (recommended)

👉 RStudio makes R easier to use.

5. Your First R Program

print("Hello, World!")

👉 This displays text on the screen.

6. Variables (Storing Data)

name <- "John"
age <- 20

👉 <- is used to assign values in R.

7. Data Types (Basic)

  • Character → "Hello"
  • Numeric → 10 or 3.5
  • Logical → TRUE / FALSE

8. Basic Calculations

5 + 3
10 * 2
20 / 4

👉 R works like a calculator.

9. Vectors (Very Important in R)

numbers <- c(1, 2, 3, 4, 5)
print(numbers)

👉 A vector stores multiple values.

10. Functions (Reusable Code)

greet <- function() {
print("Hello!")
}

greet()

11. Conditional Statements

age <- 18

if (age >= 18) {
print("Adult")
} else {
print("Minor")
}

12. Loops

For Loop

for (i in 1:5) {
print(i)
}

13. Data Frames (Working with Tables)

data <- data.frame(
name = c("John", "Mary"),
age = c(20, 22)
)

print(data)

👉 Data frames are like Excel tables.

14. Basic Data Visualization

x <- c(1, 2, 3, 4)
y <- c(10, 20, 30, 40)

plot(x, y)

👉 Creates a simple graph.

15. Real-Life Uses of R

Students can use R to:

  • Analyze survey data
  • Work on research projects
  • Create charts for reports
  • Perform statistical analysis
  • Work in data science careers

16. R vs Python (Simple Idea)

FeatureRPython
FocusStatistics & DataGeneral programming
EaseBeginner-friendlyBeginner-friendly
UsageResearch, academicsWeb, AI, automation

17. Beginner Tools to Practice

  • RStudio
  • R Console
  • Jupyter Notebook (with R kernel)

18. Simple Summary

👉 R is:

  • A data-focused programming language
  • Excellent for statistics and visualization
  • Widely used in research and business

Power Teaching Line (for your class)

👉 “If data is the new oil, then R is one of the best tools to refine it into useful insights.”

No comments:

Post a Comment

🚀 What is Microsoft SharePoint?

  🚀 What is Microsoft SharePoint ? SharePoint is a web-based platform in Microsoft 365 used for: Document management Team collaboration I...