This set of R Programming Language Multiple Choice Questions & Answers (MCQs) focuses on “Functions – 3”.
1. R Commander is used to ___________ in R.
a) Export data
b) Import data
c) Use data
d) Work on data
Explanation: R Commander is used to import data in R language. To start the R commander GUI, the user should type in the command Rcmdr into the console. There are 3 different types in which data can be imported in R language.
2. Two vectors M and N are defined as M <- c(3, 2, 4) and N <- c(1, 2). What will be the output of vector Z that is defined as Z <- M*N.
a) Z <- (3, 2, 4)
b) Z <- (3, 6, 4)
c) Z <- (3, 4, 5)
d) Z <- (3, 4, 4)
Explanation: In R language when the vectors have different lengths, the multiplication begins with the smaller vector and continues till all the elements in the larger vector have been multiplied.
3. How missing values and impossible values are represented in R language?
c) NA & NAN
d) Not Exist
Explanation: NaN (Not a Number) is used to represent impossible values whereas NA (Not Available) is referred to represent missing values. It is good to find the missing values and then take the necessary steps to handle them.
4. CRAN package ecosystem has more than ______ packages.
Explanation: R language has several packages for solving a particular problem. CRAN package ecosystem has more than 6000 packages.
5. Which function in R language is used to find out whether the means of 2 groups are equal to each other or not?
a) f.tests ()
b) l.tests ()
c) t.tests ()
d) not exist
Explanation: t.tests () function in R language is used to find out whether the means of 2 groups are equal to each other. It is not used most commonly in R. It is used in some specific conditions.
6. __________ is the best way for communicating the results of data analysis using the R language.
a) Single document
Explanation: The best possible way to do this is to combine the data, code and analysis results for a single document by knitr for reproducible research. This helps others to verify the findings, then engage in discussions.
7. How many types of data structures does R language have?
Explanation: R language consists of Homogeneous and Heterogeneous data structures. Homogeneous data structures have the same type of objects – Vector, Matrix and Array. Heterogeneous data structures have a different type of objects – Data frames and lists.
8. __________ is the easiest method for reshaping the data before analysis.
Explanation: Transpose t () is the easiest method for reshaping the data before analysis. The transpose (reversing rows and columns) is always the simplest method of reshaping a dataset. Use the t() function to transpose a matrix or a data frame.
9. ___________ function is used to apply an expression for a given dataset.
Explanation: With a () function is used to apply an expression for a given dataset. R language has a large number of in-built functions and the user can create their own functions. In R, a function is an object to the R interpreter is able to pass control to the function.
10. __________ package is used to speed up data frame management code.
Explanation: dplyr is a powerful R-package to transform and summarize tabular data with rows and columns. dplyr package is used to speed up data frame management code. dplyr is a package for data manipulation, written and maintained regularly by Hadley Wickham.
Sanfoundry Global Education & Learning Series – R Programming Language.
Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!