← R Programming learning path
R Programming · Module 7 of 10

Statistics in R

Calculate statistics and run tests.

📖 Key ideas

  1. Descriptive: mean, median, sd, var, quantile, table.
  2. Correlation: cor(x, y).
  3. t.test compares means; chisq.test tests categorical association.
  4. p-values help judge if results are likely due to chance.
  5. R makes statistics easy, but you must interpret carefully.
💡 Real-life example: Statistical tests are referees: they judge if a difference is real or just luck.
sd()Standard deviation
cor()Correlation coefficient
t.test()Compares means
p-valueChance of results if no real effect