R Basic-Dumps - Classicoder.com - CLASSIC CODER #header (Ativar o PHP)

# R Basic-Dumps - Classicoder.com Assume that you have a vector x <-c(3,5,1,10,12,6) and you wish to set all elements of this

vector that are smaller than 6 to be equal to 0, what R code accomplishes this?

What would be the result of following code?

x<-c("x", "y", "z") as.logical(x)

If I have two vectors, x<-c(1,3,5) and y<-c(3,2,10), what does rbind(x,y) give?

Answer:  A 2 x 3 matrix

Which command allows you to get the median tree Height of the R sample dataset "trees"?

Which function is used to generate Sequences in R?

Which of the following statements is correct?

Answer:  NaN can also be thought of as a missing value.

What is the output of the R code?

m<-c(1, 2, 3) n<-c(6, 5, 4) (m<2) & (n> 5)

Which function can be used to create collection of vectors objects?

An important property of vectors in R is that

Answer:  All elements must be of the same class

What command will you enter in the R console to get help on how to quit R?

Which R command creates a 2 by 2 matrix with the values 1, 2, 3, and 4?

Answer:  m <- matrix(1:4, 2, 2)

Which of the following statements is correct?

What would be the result of following code?

x <- 0:4 as.logical(x)

Answer:  FALSE TRUE TRUE TRUE TRUE

Which of the following while loops will print numbers from 1 to 4?

Answer: x<-1 while(x < 5) { print(x); x <-x+1;}

What is the class of the object defined by the expression x<-c(4,"a",TRUE) in R?