R Programming Quiz Questions and Answers

If the code is stored in the external file, which of the following function is used to call them to a working directory?

Answer :
  • source()

Explanation :

source is available in the file menu. Today R runs on almost any standard computing platform and operating system. Its open source nature. The copyright for the primary source code for R is held by the R Foundation and is published under the GNU General Public License version. 4. Advanced programmers can write ______ code to manipulate R objects.

What is the output of getOption(“defaultPackages”) in R studio?

Answer :
  • Shows default packages in R

Explanation :

There are base packages (which come with R automatically), and contributed packages. The base packages are maintained by a select group of volunteers called R Core. In addition to the base packages, there are over ten thousand additional contributed packages written by individuals all over the world.

What is the meaning of the following R function? x <- c(4, 5, 1, 2, 3, 3, 4, 4, 5, 6) x <- as.factor(x)

Answer :
  • x becomes a factor

Explanation :

Factors are used to represent categorical data and can unordered and ordered. One can think of a factor as an integer vector where each integer has a label. Factors are important in statistical modelling and are treated specially by modelling functions like lm() and glm().

Parallel processing is done via __________ package can make the elapsed time smaller than the user time.

Answer :
  • parallel

Explanation :

When you have multiple processors/- cores/machines working in parallel, the amount of time that the collection of CPUs spends working on a problem is the same as with a single CPU, but because they are operating in parallel, there is a savings in elapsed time.

What is predicting y for a value of x that is within the interval of points that we saw in the original data called?

Answer :
  • Intra polation

Explanation :

Predicting y for a value of x that is within the interval of points that we saw in the original data is called interpolation. Predicting y for a value of x that’s outside the range of values we actually saw for x in the original data is called extrapolati

A single element of a character vector is referred as ________.

Answer :
  • Character string

Explanation :

Single element of a character vector is often referred to as a character string. Dates are represented by the Date class and can be coerced from a character string using the as.Date() function. This is a common way to end up with a Date object in R.

______ let’s you perform SQL queries on your R data frames.

Answer :
  • plyr

Explanation :

sqldf uses SQLite syntax. Plyr will split-apply-combine paradigm for R. Forecast is a generic function for forecasting from time series or time series models. The function invokes particular methods which depend on the class of the first argument.

A data frame is a special type of list where every element of the list has ______ length.

Answer :
  • Same

Explanation :

A data frame is a very important data type in R. It’s pretty much the de facto data structure for most tabular data and what we use for statistics. A data frame was a special type of list in which every element of the list has the same length.

The ________ stores the nominal values as a vector of integers in the range of 1 to unique values in the nominal variable.

Answer :
  • Factor

Explanation :

The factor stores the nominal values as a vector of integers in the range [1… k] (where k is the no. of unique values of the nominal variable), and an internal vector of character strings (the original values) mapped to these integers.

The __________ package has functionality to investigate transformations of univariate distributions.

Answer :
  • Distr

Explanation :

The distr package has a functionality to find the transformations of one variable distribution. There are exact results for the ordinary transformations for the standard distributions, and distr takes advantage of these in many cases.