0% found this document useful (0 votes)
1 views15 pages

R-Programming Lab Record-MBA-2025

The document lists a series of experiments involving R programming, each detailing specific tasks such as taking user input, creating matrices and data frames, generating plots, and performing calculations. Each experiment includes an aim, description, program code, and expected output. The experiments cover a wide range of R functionalities, providing practical coding exercises for users.

Uploaded by

kanurisubbarao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views15 pages

R-Programming Lab Record-MBA-2025

The document lists a series of experiments involving R programming, each detailing specific tasks such as taking user input, creating matrices and data frames, generating plots, and performing calculations. Each experiment includes an aim, description, program code, and expected output. The experiments cover a wide range of R functionalities, providing practical coding exercises for users.

Uploaded by

kanurisubbarao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

LIST OF EXPERIMENTS:

1) Write a R program to take input from the user (name and age) and display the values.
Also print the version of R installation.

2) Write a R program to get the details of the objects in memory.

3) Write a R program to create a sequence of numbers from 20 to 50 and find the mean of
numbers from 20 to 60 and sum of numbers from 51 to 91.

4) Write a R program to create a simple bar plot of five subjects marks.

5) Write a R program to get the unique elements of a given string and unique numbers of
vector.

6) Write a R program to create three vectors a,b,c with 3 integers. Combine the three
vectors to become a 3×3 matrix where each column represents a vector. Print the content of
the matrix.

7) Write a R program to create a 5 x 4 matrix , 3 x 3 matrix with labels and fill the matrix
by rows and 2 × 2 matrix with labels and fill the matrix by columns.

8) Write a R program to combine three arrays so that the first row of the first array is
followed by the first row of the second array and then first row of the third array.

9) Write a R program to create a two-dimensional 5x3 array of sequence of even integers


greater than 50.

10) Write a R program to create an array using four given columns, three given rows, and
two given tables and display the content of the array.

11) Write a R program to create an empty data frame.

12) Write a R program to create a data frame from four given vectors.

13) Write a R program to create a data frame using two given vectors and display the
duplicated elements and unique rows of the said data frame.

14) Write a R program to save the information of a data frame in a file and display the
information of the file.

15) Write a R program to create a matrix from a list of given vectors.

16) Write a R program to concatenate two given matrices of same column but different
rows.

17) Write a R program to find row and column index of maximum and minimum value in a
given matrix.
18) Write a R program to append value to a given empty vector.

19) Write a R program to multiply two vectors of integers type and length 3.

20) Write a R program to find Sum, Mean and Product of a Vector, ignore element like NA
or NaN.

21) Write a R program to list containing a vector, a matrix and a list and give names to the
elements in the list.

22) Write a R program to create a list containing a vector, a matrix and a list and give
names to the elements in the list. Access the first and second element of the list.

23) Write a R program to create a list containing a vector, a matrix and a list and remove
the second element.

24) Write a R program to select second element of a given nested list.

25) Write a R program to merge two given lists into one list.

26) Write a R program to create a list named s containing sequence of 15 capital letters,
starting from ‘E’.

27) Write a R program to assign new names "a", "b" and "c" to the elements of a given
list.

28) Write a R program to find the levels of factor of a given vector.

29) Write a R program to create an ordered factor from data consisting of the names of
months.

30) Write a R program to concatenate two given factor in a single factor.


Experiment-1

1) Write a R program to take input from the user (name and age) and display the values.
Also print the version of R installation.

AIM:

DESCRIPTION:

PROGRAM:

name = readline(prompt="Input your name: ")

age = readline(prompt="Input your age: ")

print(paste("My name is",name, "and I am",age ,"years old."))

print(R.version.string)

OUTPUT:
Experiment-2

2) Write a R program to get the details of the objects in memory.

AIM:

DESCRIPTION:

PROGRAM:

name = "Python";

n1 = 10;

n2 = 0.5

nums = c(10, 20, 30, 40, 50, 60)

print(ls())

print("Details of the objects in memory:")

print(ls.str())

OUTPUT:
Experiment-3

3) Write a R program to create a sequence of numbers from 20 to 50 and find the mean of
numbers from 20 to 60 and sum of numbers from 51 to 91.

AIM:

DESCRIPTION:

PROGRAM:

print("Sequence of numbers from 20 to 50:")

print(seq(20,50))

print("Mean of numbers from 20 to 60:")

print(mean(20:60)) print("Sum of numbers from 51 to 91:")

print(sum(51:91))

OUTPUT:
Experiment-4

4) Write a R program to create a simple bar plot of five subjects marks.

AIM:

DESCRIPTION:

PROGRAM:

marks = c(70, 95, 80, 74)

barplot(marks,

main = "Comparing marks of 5 subjects",

xlab = "Marks",

ylab = "Subject",

names.arg = c("English", "Science", "Math.", "Hist."),

col = "darkred",

horiz = FALSE)

OUTPUT:
Experiment-5

5) Write a R program to get the unique elements of a given string and unique numbers of
vector.

AIM:

DESCRIPTION:

PROGRAM:

str1 = "The quick brown fox jumps over the lazy dog."

print("Original vector(string)")

print(str1)

print("Unique elements of the said vector:")

print(unique(tolower(str1)))

nums = c(1, 2, 2, 3, 4, 4, 5, 6)

print("Original vector(number)")

print(nums)

print("Unique elements of the said vector:")

print(unique(nums))
OUTPUT:
Experiment-6

6) Write a R program to create three vectors a,b,c with 3 integers. Combine the three
vectors to become a 3×3 matrix where each column represents a vector. Print the content of
the matrix.

AIM:

DESCRIPTION:

PROGRAM:

a<-c(1,2,3)

b<-c(4,5,6)

c<-c(7,8,9)

m<-cbind(a,b,c)

print("Content of the said matrix:")

print(m)

OUTPUT:
Experiment-7

7) Write a R program to create three vectors a,b,c with 3 integers. Combine the three
vectors to become a 3×3 matrix where each column represents a vector. Print the content of
the matrix.

AIM:

DESCRIPTION:

PROGRAM:

a<-c(1,2,3)

b<-c(4,5,6)

c<-c(7,8,9)

m<-cbind(a,b,c)

print("Content of the said matrix:")

print(m)

OUTPUT:
Experiment-8

6) Write a R program to create three vectors a,b,c with 3 integers. Combine the three
vectors to become a 3×3 matrix where each column represents a vector. Print the content of
the matrix.

AIM:

DESCRIPTION:

PROGRAM:

a<-c(1,2,3)

b<-c(4,5,6)

c<-c(7,8,9)

m<-cbind(a,b,c)

print("Content of the said matrix:")

print(m)

OUTPUT:
Experiment-9

6) Write a R program to create three vectors a,b,c with 3 integers. Combine the three
vectors to become a 3×3 matrix where each column represents a vector. Print the content of
the matrix.

AIM:

DESCRIPTION:

PROGRAM:

a<-c(1,2,3)

b<-c(4,5,6)

c<-c(7,8,9)

m<-cbind(a,b,c)

print("Content of the said matrix:")

print(m)

OUTPUT:
Experiment-10

6) Write a R program to create three vectors a,b,c with 3 integers. Combine the three
vectors to become a 3×3 matrix where each column represents a vector. Print the content of
the matrix.

AIM:

DESCRIPTION:

PROGRAM:

a<-c(1,2,3)

b<-c(4,5,6)

c<-c(7,8,9)

m<-cbind(a,b,c)

print("Content of the said matrix:")

print(m)

OUTPUT:
Experiment-11

6) Write a R program to create three vectors a,b,c with 3 integers. Combine the three
vectors to become a 3×3 matrix where each column represents a vector. Print the content of
the matrix.

AIM:

DESCRIPTION:

PROGRAM:

a<-c(1,2,3)

b<-c(4,5,6)

c<-c(7,8,9)

m<-cbind(a,b,c)

print("Content of the said matrix:")

print(m)

OUTPUT:
Experiment-12

6) Write a R program to create three vectors a,b,c with 3 integers. Combine the three
vectors to become a 3×3 matrix where each column represents a vector. Print the content of
the matrix.

AIM:

DESCRIPTION:

PROGRAM:

a<-c(1,2,3)

b<-c(4,5,6)

c<-c(7,8,9)

m<-cbind(a,b,c)

print("Content of the said matrix:")

print(m)

OUTPUT:

You might also like