ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)
Set your Publisher ID in src/config/ads.ts to display live ads.
R Statistical Programming Tutorial• 5 min read
Introduction to R & Vectors
Understand R syntax, vector creation using c(), and basic statistical functions.
What is R?
R is a programming language designed specifically for statistical computing, data mining, and graphics. Widely used across pharmaceuticals, academic research, finance, and marketing analytics, R treats vectors as first-class citizens.
In R, the standard assignment operator is <- (although = also works, <- is the idiomatic standard).
Vector Operations in R
# Creating vectors with c() (combine)
temperatures <- c(22.4, 25.1, 19.8, 28.3, 24.0)
# Statistical calculations
avg_temp <- mean(temperatures)
med_temp <- median(temperatures)
sd_temp <- sd(temperatures)
cat("Mean Temp:", avg_temp, "\n")
cat("Standard Deviation:", round(sd_temp, 2), "\n")ADVERTISEMENT
Google AdSense Slot (inContentBanner)
Set your Publisher ID in src/config/ads.ts to display live ads.
Test Yourself With Exercise
Which function is used in R to combine values into a vector?