Virtual Lab Format 3
Virtual Lab Format 3
LAB MANUAL
Course : MCA
SEMESTER
II
SUBJECT TITLE
DATA ANALYSIS USING R
SUBJECT CODE
V20PCA207
Prepared By
S. Mythreyi Koppur
Asst.Professor , DOE,
SRM IST
3. To impart the concepts like installing, loading datasets, working with data
frames in R Programming.
COURSE OUTCOME
This manual is intended for the First year students of MCA branch in the subject
of Data Analysis using R . This manual typically contains practical/Lab Sessions
related to Programming Language covering various aspects related the subject to
enhanced understanding.
Although, as per the syllabus, R programs are prescribed, we have made the
efforts to cover various aspects of Software Developing Languages
Students are advised to thoroughly go through this manual rather than only topics
mentioned in the syllabus as practical aspects are the key to understanding and
conceptual visualization of theoretical aspects covered in the online contents.
Guidelines
1. Students are instructed to perform their lab exercises/assignments at their
own system from their respective residences
2.Writing and editing the program in your system.
Compiling and Executing the program and save the output
3. The students are also advised to submit completed Lab assignments in the
prescribed format (Appendix-1) in LMS
4. The students are advised to complete the weekly activities/assignments well in
time.
5. The submitted Lab Assignment will be evaluated for end semester Practical
examination
6. The students must get the completed Lab Assignments evaluated by the
concerned course coordinator by LMS , Failing which the Lab assignments for that
week will be treated as incomplete.
7. At least TEN (10) such timely completed Lab assignments are compulsory,
failing which students will not be allowed to appear in the final end semester Lab
Examination.
2. Process Steps/Description
3.Methodology
R platform
4.Sample coding
library(dplyr)
library(ggplot2)
class10 <- c(74, 122, 235, 111, 292, 111, 211, 133, 156, 79)
length(class10)
sum(class10)
sum(class10)/length(class10)
mean(class10)
class10 - mean(class10)
(class10)^2 / length(class10)
sqrt(class10)
fees <- c(10500, 45000, 74100, NA, 83500, 86000, 38200, NA,
44300, 12500, 55700, 43900, 71900, NA, 62000)
sum(fees)
sum(fees, na.rm = TRUE)
mean(fees, na.rm=TRUE)
datasets::precip
head(precip)
head( sort(precip, decreasing=TRUE) )
5.Sample Output:
> library(dplyr)
filter, lag
Warning message:
package ‘dplyr’ was built under R version 4.1.3
> library(ggplot2)
Warning message:
package ‘ggplot2’ was built under R version 4.1.3
> class10 <- c(74, 122, 235, 111, 292, 111, 211, 133, 156, 79)
> length(class10)
[1] 10
> sum(class10)
[1] 1524
> sum(class10)/length(class10)
[1] 152.4
> mean(class10)
[1] 152.4
> class10 - mean(class10)
[1] -78.4 -30.4 82.6 -41.4 139.6 -41.4 58.6 -19.4 3.6 -73.4
> (class10)^2 / length(class10)
[1] 547.6 1488.4 5522.5 1232.1 8526.4 1232.1 4452.1 1768.9
[9] 2433.6 624.1
> sqrt(class10)
[1] 8.602325 11.045361 15.329710 10.535654 17.088007 10.535654
Thus the code was successfully executed, and the output is verified
APPENDIX-II
LIST OF EXPERIMENTS -ASSIGNMENTS -LMS
Assignment Title of Program
No
1 Assign a set of values to a data vector, then find its length and
sum and sqrt.
2 Assign a set of values to a variable with some missing values (NA)
and then calculate its sum and mean
3 From the inbuilt dataset in R, list the first 6 rows using the head
function then sort it in descending order.