Assignment 4: Vector and List in R programming
1. Write a R program to create a vector of a specified type
and length. Create vector of numeric, complex, logical and character types of
length 6.
Answer :
2. Write a R program to add, multiply and divide two vectors
of integers type and length 3.
Answer :
3. Write a R program to create a list containing strings,
numbers, vectors and a logical values.
Answer :
4. Write a R program to 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.
Answer :
SET A:
1. Write an R program to sort a Vector in ascending and
descending order.
Answer :
2. Write an R program to find Sum, Mean and Product of a
Vector.
Answer :
3. Write a R program to sort a Vector in ascending and
descending order.
Answer :
4. Create a list containing a four vectors and give names to
the elements in the list
Answer :
5. Write a R program to merge two given lists into one list.
Answer:
6. Write a R program to convert a given list to vector.
Answer :
7. Write a R program to create a list named s containing
sequence of 15 capital letters, starting from ‘E’.
Answer :
SET B:
1. Write a R program to find all elements of a given list
that are not in another given list.
Answer :
2. Write a R program to extract all elements except the
third element of the first vector of a given list.
Answer :
3. Write a script in R to create a list of cities and
perform the following
1) Give names to the elements in the list.
2) Add an element at the end of the list.
3) Remove the last element.
4) Update the 3rd Element
Answer :
4. Write a script in R to create a list of students and
perform the following
a. Give names to the students in the list.
b. Add a student at the end of the list.
c. Remove the first Student.
d. Update the second last student.
Answer:
5. Write a script in R to create a vector of numbers and perform the following
a. Search for specific element
Answer :
b. Count the occurrences of specific element
Answer :
c. Access the last element of given vector
Answer :
SET C:
1. Write a R program to extract every nth element of a given
vector.
Answer :
2. Write a R program to select second element of a given
nested list.
Answer :
No comments:
Post a Comment