Preface
This laboratory manual has been prepared to help Second year engineering students
develop practical, hands-on skills in the R programming language for statistical
computing, data handling, and graphical data analysis. R is a free, open-source
software environment widely used in engineering, research, and industry for data
analysis and visualization.
Each experiment in this manual follows a standard format consisting of the Aim,
Theory, R Program, Sample Output, Result and Exercises. Students are expected to
type and execute every program themselves in the R console or RStudio, observe
the output, and answer the exercise questions in their own record books.
General Instructions to Students
● Install R and RStudio on your system before the first laboratory session
(download from https://cran.r-project.org and
https://posit.co/download/rstudio-desktop/).
● Maintain a separate laboratory record. Write the Aim, Program, and Result for
every experiment before entering the laboratory.
● Save all R scripts with meaningful file names and the extension .R (e.g.,
exp3_matrices.R).
● Use the RStudio 'Console' pane to run commands interactively and the 'Script'
pane to save reusable code.
● Use help(function_name) or ?function_name within R to explore any built-in
function further.
● Attempt the exercise questions given at the end of every experiment; they are
compulsory for internal assessment.
● Always set a working directory using setwd() or an RStudio Project before
reading or writing files.
List of Experiments
1. Experiment 1: Getting Started: Reading and Getting Data into R
2. Experiment 2: Ordered and Unordered Factors
3. Experiment 3: Arrays and Matrices
4. Experiment 4: Lists and Data Frames
5. Experiment 5: Reading Data from External Files
6. Experiment 6: Probability Distributions in R
7. Experiment 7: Statistical Models in R
8. Experiment 8: Introduction to Graphical Analysis – Basic Plots
9. Experiment 9: Displaying Multivariate Data and Matrix Plots
10. Experiment 10: Multiple Plots in One Window and Exporting Graphs