R Programming
What is the output of the following commands? > x <- c(1, 2) > y <- c(x, 0, x) > z <- 2*x + y + 1 > z
What is the correct way of converting a factor to integer in R?
What is the output of the following commands? > x <- c(1, 2) > y <- c(4, 5) > pmax(x, y)
What is the output of the following expression? num <- 5; res <- 1; for (i in 1:num) { if (i%%2 == 0) {res <- res * i}}; res
What is the output of the following code? > x <- c(0, 1, 2, 3, 4, 5, 6, 7) > dim(x) <- c(2,2,2) > x[1,1,2]
What is the result of the following code? > a <- array(c(0:1, 1:0), dim=c(2,2)) > a %*% a
What will be the output of the following program on R interpreter?temp <- c("Comp|ex","Simple")cnt <- 10repeat[print(temp)cnt <ā cnt-1if(cnt < 6.5) {break1}
What is the output of the following expression? > c(0, FALSE)
What is the output of the following code? > x <- outer(1:2, 1:2, FUN = "*") > x
What is the difference between seq(4) and seq_along(4)?
What is the result of the following code? > x <- 0:3 > y <- as.character(x) > z <- as.integer(y) > z
What is the result of the following R code? > x <- c(0, 1, 2, 3, 4, 5, 6, 7) > dim(x) <- c(2,2,2) > x[,2,]
What is the difference between matrix and dataframe?
Lst <- list(name="Fred", wife="Mary", no.children=3, child.ages=c(4,7,9)) What is the value of length(Lst)?
"%UpWork%" <- function(x, y) {upw <- x + y; upw} ans <- c(1,2)%UpWork%c(2,3) What is value of ans?
What is the output of the following expression? > x <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) > x[-(1:3)]
What is returned by the following code? x <- 0 y <- 10 f <- function() { x <- 1 g() } g <- function() { x <- 2 h() } h <- function() { x <- 3 x + y } f()
What is the output of the following commands? > x <- c(1:3, NA) > y <- is.na(x) > y
What is the output of the following commands? > x <- c(-1, 0, 1, 2, NA) > (x+1)[(!is.na(x)) & x>0]
Lst <- list(name="Fred", wife="Mary", no.children=3, child.ages=c(4,7,9)) What is Lst[[1]]?
What is the use of the doBY package?
Following is a function definition in R programming language:dummy.function <- function(a.b.c) [result -=- a ā+ b ' cprint(result)]Which of the following function calls will give the output: 41895?
What is the output of the following expression? > c(list(1), "1")
What is the output of the following command? > 2*1:10
What is the factor variable in R language?
Let v be a vector. What is the correct way of creating a factor from v?
What is the output of the following commands? > x <- paste(c("X", "Y"), 1:2, sep='') > x
Lst <- list(name="Fred", wife="Mary", no.children=3, child.ages=c(4,7,9)) What is the value of Lst[[4]][2]?
R uses the function. barplotii. to create bar charts. The basic syntax to create a bar chart In R is:barplot(H. xlab. yiab. main. namesarg. col)Which of the following options are correct?
What is the result of the following R code? > x <- 0:6 > y <- x[2 * 1:3] > length(y) <- 2 > y
What is the result of the following R code? > x <- array(0:7, dim=c(2,2,2)) > i <- array(c(1:2, 4:3), dim=c(2,2)) > x[i]
What is the result of the following R code? > a <- array(0:7, dim=c(2,2,2)) > b<-a%*%a > b[1]
fun1 <- function(a, b, c, ... ) { ans <- 2; ans} s <- fun1(1, 2, 3, 4, 5, 6, 7, 8) What is the value contained by s?
What is the output of the following commands?> x <- c(1, 2)> y <- c(x, 0, x)> prod(y)
in R language, in order to calculate the mean of a given set of values, the mean() function is used. Following is the basic syntax for the same:mean(x, trim = O, na.rm = FALSE, ...)Which of the following parameters is used to remove the missing values from the input vector?
What is the output of the following code? > y <- 5; f <- function(x) { y <-2; y^2 + g(x)}; g <- function(x) { x + y } > f(4)