R Tutorial
R is a programming language made for statistics, data analysis and charts. It is free, and it is used at universities, hospitals, banks and research centres around the world.
R was designed by statisticians, so tasks like finding an average, comparing groups or summarising a table take only one short line.
Why Learn R?
- It has thousands of free packages for statistics, data cleaning and graphics
- It is widely used in research, medicine, economics and social sciences
- Data frames, tables of data, are built right into the language
- Learning R and Python together makes you a stronger data analyst
A First Example
Example
marks <- c(78, 85, 62, 90, 74)
mean(marks)
summary(marks)[1] 77.8 Min. 1st Qu. Median Mean 3rd Qu. Max. 62.0 74.0 78.0 77.8 85.0 90.0
Two short lines give the average and a full summary of five students' marks.
What You Will Learn
- Installing R and RStudio and running your first code
- Syntax, comments and variables
- Data types and operators
- Vectors, the heart of R
- Lists, matrices and factors
- Data frames for working with tables
- Decisions, loops and your own functions
No programming experience is needed to start.
Exercise
What does the c() function do in R?
What to Learn After R
If you want a general-purpose language for data and AI, learn Python, then Pandas for data tables and SciPy for statistics.
Want to learn data skills with a teacher? The Workownix Python Programming course covers programming and data analysis with real projects, online or at our institute in Orangi Town, Karachi.
