Assignment-1


ยท         1. create the vectors:

o   (1, 2, 3, . . . , 19, 20)

o   (20, 19, . . . , 2, 1)

o   (1, 2, 3, . . . , 19, 20, 19, 18, . . . , 2, 1)

o   (4, 6, 3) and assign it to the name tmp.

o   (4, 6, 3, 4, 6, 3, . . . , 4, 6, 3) where there are 10 occurrences of 4.

o   (4, 6, 3, 4, 6, 3, . . . , 4, 6, 3, 4) where there are 11 occurrences of 4, 10 occurrences of 6 and 10 occurrences of 3.

o   (4, 4, . . . , 4, 6, 6, . . . , 6, 3, 3, . . . , 3) where there are 10 occurrences of 4, 20 occurrences of 6 and 30 occurrences of 3.

 

2. Create a vector of the values of x^2 at x = 3, 3.1, 3.2, . . . , 6.

 

3.  Generate the following vector x using sequence:

    (1   2   3   4   5   6 144 145 146 147 148 149 288 289 290 291 292 293)



4. Create a factor variable x as  (High , High , Low , Low , High , Medium , Low , Medium , Medium , Medium).

    The levels should be in the order Low , Medium , high.

5.Suppose there is a vector X (12,17,22,27,.....................144) and vector Y (17,21,25,29..............114).

    Generate a vector Z which should include common elements of X and Y.  Write a code which checks whether or not  60 is present in vector X.