Professional Documents
Culture Documents
5. Suppose I have a vector x <- c(3, 5, 1, 10, 12, 6) and I want to set all elements of this vector that are less than
6 to be equal to zero. What R code achieves this?
A) x[x < 6] == 0
B) x[x == 6] <- 0
C) x[x < 6] <- 0
D) x[x == 0]
6. To remove objects Which function is available:
1. Rm
2. Ls
3. Remove
7. Which are the important types of Objects in R
1. Array
2. Vectors
3. Matrices
8. What is the output of the following Code:
>x=c(5,6,8,9)
> which(x>7)
> x==8
9. What is the output :
i=1
while (i <= 10)
{
print(i)
i=i+1
}
10. We cannot typecast a character to integer or numeric but the integer or numeric value can be typecasted as
character
1. TRUE
2.FALSE
11. To get more information on any specific named function, for example mean, the command is
____________________________.
12. What do you suppose numeric(100) does?
13. Create a vector with 13 elements starting from 1 to 2.2 and the increment between the successive elements
of vectors be .1
20. Suppose the IQ scores of 20 elementary school students are listed in the vector IQ below
IQ <- c( 84, 108, 98, 110, 86, 123, 101, 114, 121, 131, 90, 108, 105, 93, 95, 102, 119, 98, 94, 73)
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________