Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

SRM Institute of Science and Technology

Directorate of Online Education


Batch H
Sem - 2-A (SRM Regulation 2020)
Degree / Branch Date of Exam: M.C.A. - [PG - ONLINE - ACADEMIC]
Subject Code /Semester: Exam: V20PCA207 / DATA ANALYSIS USING R
Date: 20/12/2023 FN / AN

Name of the Student: Pratham Babre


Register Number: EC2332251010279

---------------------------------------------------------------------------------------------------------

Title: Find its length, sum and mean. Usingsequence function generate the numbers, increment by
10.

Aim:-
Assign 10 values to a variable. Find its length, sum and mean. Usingsequence function generate the
numbers, increment by 10.

PROCEDURE STEPS/ALOGRITHM:
1. Start the program or R environment.
2. Assign 10 values to a variable using the c() function and store it in a variable, such as
values.
3. Calculate the length of the variable using the length() function and store it in a
variable, such as length_value.
4. Calculate the sum of the values using the sum() function and store it in a variable,
such as sum_value.
5. Calculate the mean of the values using the mean() function and store it in a variable,
such as mean_value.
6. Generate a sequence of numbers incremented by 10 using the seq() function,
specifying the start, end, and increment values. Store the sequence in a variable, such
as sequence.
7. Display the length, sum, mean, and generated sequence using the cat() or print()
function.
8. End the program or continue with additional data analysis tasks.
PROGRAM :

# Assign 10 values to a variable


values <- c(5, 10, 15, 20, 25, 30, 35, 40, 45, 50)

# Length of the variable


length_value <- length(values)
cat("Length:", length_value, "\n")

# Sum of the values


sum_value <- sum(values)
cat("Sum:", sum_value, "\n")

# Mean of the values


mean_value <- mean(values)
cat("Mean:", mean_value, "\n")

# Generate a sequence of numbers incremented by 10


sequence <- seq(0, 90, by = 10)
cat("Sequence:", sequence, "\n")

RESULT/OUTPUT :

Length: 10
Sum: 275
Mean: 27.5
Sequence: 010 20 30 40 50 60 70 80 90
RESULT :

That's it! By following these steps/algorithms, you can perform data analysis on a variable in
R, find its length, sum, and mean, and generate a sequence of numbers incremented by 10.

You might also like