Data Structures In R Programming - Study Mode

[#71] How do you create a named numeric vector with values 1, 2, and 3 named "one", "two", and "three" in R?
Correct Answer

(D) vec_named(c(1, 2, 3), c("one", "two", "three"))

[#72] Which of the following function gives the day of the week?
Correct Answer

(A) weekdays

[#73] What will be the output of the following R code? > x <- as.POSIXct("2012-10-25 01:00:00")
> y <- as.POSIXct("2012-10-25 06:00:00", tz = "GMT")
> y-x
Correct Answer

(A) Time difference of 1 hour

[#74] What will be the output of the following R code? > x <- list(foo = 1:4, bar = 0.6, baz = "hello")
> name <- "foo"
> x[[name]]
Correct Answer

(A) 1 2 3 4

[#75] What will be the output of the following R code? > datestring <- c("January 10, 2012 10:40", "December 9, 2011 9:10")
> x <- strptime(datestring, "%B %d, %Y %H:%M")
> x
Correct Answer

(A) "2012-01-10 10:40:00 EST" "2011-12-09 09:10:00 EST"