Vit Online Learning Institute: Worksheet - I Creation of Vectors and Strings
Vit Online Learning Institute: Worksheet - I Creation of Vectors and Strings
WORKSHEET – I
CREATION OF VECTORS AND STRINGS
Course Name: Programming in R Faculty: Dr. Swarna Priya RM
Credits: 4
1. Create the vectors:
(a) Numeric vector having elements 123,45,67,28,59
(b) Integer Vector having elements 45,56,89,2,34,56
(c) Character vector having elements to be name of the months.
(d) Complex vector with any set of 10 complex numbers.
2. Use the function paste to create the following character vectors. First create the vector. And
then use paste function to form a sentence as per the requirement given in each case. Print on
the console.
(a) ("HI", "HOW", “DO”,”YOU”,”DO”).
Note that there is a single space between them.
(b)("This", “is”,”really”,”Awesome”,”to”,”learn”,”that”,”am”,”able”,”to”,”program”).
(i) In this case, there is no space between the words.
(ii) In this case the words are separated by using the character ‘–‘.
3. Create a vector of having the co-efficients of the quadratic equation as given below. Name
them as quad1…quadn.
(i) 10x3 + 8x2 + 7x + 3=0
(ii) 12y4 – 10y3 +14y2 -5y -3=0
(iii) 22z4 – 11z3 +13z2 -15z -33=0