Objects And Operations(Engineering > Computer Science And Engineering > R Programming > R – Data Storage > Formats ) Questions and Answers
Question 1. What would be the output of the following code ? p - as.POSIXlt(x) names(unclass(p)) p$wday
1
2
3
NULL
Explanation:-
Answer: Option A. -> 1
The POSIXlt object contains some useful metadata.
Question 2. What would be the output of the following code ?x - 1:4 y - 6:9 x/y
0.1666667 0.2857143 0.4444444
0.1666667 0.2857143 0.3750000 0.4444444
0.2857143 0.3750000 0.4444444
All of the mentioned
Explanation:-
Answer: Option B. -> 0.1666667 0.2857143 0.3750000 0.4444444
Logical operations return a logical vector of TRUE and FALSE.
Question 3. Point out the wrong statement :
$ operator semantics are similar to that of [[
The [[ operator can take an integer sequence if you want to extract a nested element of a list
The $ operator can be used to extract multiple elements from a list
All of the mentioned
Explanation:-
Answer: Option C. -> The $ operator can be used to extract multiple elements from a list
The [ operator can be used to extract multiple elements from a list.
Question 4. What would be the output of the following code ?x - 1:4 y - 6:9 z - x + y z
7 9 11 13
7 9 11 13 14
9 7 11 13
NULL
Explanation:-
Answer: Option A. -> 7 9 11 13
This is simplest example of adding two vectors together.
Question 5. Which of the following argument denotes if the file has a header line ?
header
sep
file
All of the mentioned
Explanation:-
Answer: Option A. -> header
sep is a string indicating how the columns are separated.
Question 6. What would be the output of the following code ?x - c("a", "b", "c", "c", "d", "a") x[c(1, 3, 4)]
a" b" c"
a" c" c"
a" c" b"
All of the mentioned
Explanation:-
Answer: Option A. -> a" b" c"
The sequence does not have to be in order; you can specify any arbitrary integer vector.
Question 7. Columns can be arranged in descending order too by using the special ____ operator.
asc()
desc()
descending()
subset
Explanation:-
Answer: Option B. -> desc()
This will sort the order in decreasing order.
Question 8. Point out the wrong statement :
The dplyr package was developed by Hadley Wickham of RStudio
The dplyr packageis an optimized and distilled version of his plyr package
The dplyr package provideS any new" functionality to R
None of the mentioned
Explanation:-
Answer: Option B. -> The dplyr packageis an optimized and distilled version of his plyr package
The dplyr package does not provide any "new functionality to R.
Question 9. Which of the following statement will save the output to the file for following code ?a - data.frame(x = rnorm(100), y = runif(100)) b - c(3, 4.4, 1 / 3)
save(a, b, file = mydata.rda")
save_image(a, b, file = mydata.rda")
keep(a, b, file = mydata.rda")
All of the mentioned
Explanation:-
Answer: Option D. -> All of the mentioned
You can save all objects in your workspace using the save.image() function.
Question 10. Connections to text files can be created with the ________ function.
url
gzfile
bzfile
file
Explanation:-
Answer: Option D. -> file
The file() function has a number of arguments that are common to many other connection functions.