Questions about R: Important Frequently Asked

This post is about some frequently asked Questions about R Language. The frequently asked questions are about compilers in R, R packages, just in just-in-time compilers, procedural programming in R, and the Recycling rule of vectors. These questions will help you prepare for examinations and interviews.

Frequently Asked Questions About R

Questions about R Language

Question: What is a Compiler in R Language?
Answer: A compiler is software that transforms computer code (source code) to another computer language (target language, i.e., object code).

Question: What is a package in R Language?
Answer: The R package is a collection of R functions, compiled code, sample data, and help documentation. The R packages are stored in a directory called “library” in the R environment. The R language also installed a set of packages during installation.

Question: What is JIT?
Answer:
JIT standards for “Just in Time” compiler. It is a method to improve the run-time performance of a computer program.

Question: What is procedural Programming in R Language?
Answer:
Procedural programming is derived from structured programming and it is based on the concept of procedure call. Procedures are also known as routines, subroutines, or functions. It contains a series of computational steps to be carried out. Any procedure may be called (at any point) during a program’s execution.

Mathematical Operation in R

Question: What is the recycling of elements in a vector?
Answer: When a mathematical operation (such as addition, subtraction, multiplication, division, etc) is performed on two vectors of different lengths (the number of elements in both vectors is different), the element having a shorter length is reused to complete the mathematical operations.

vect1 <- c(4, 1, 4, 5, 6, 9)
vect2 <- c(2, 5)
vect1 * vect2 

###
8, 5, 8, 25, 12, 45

The elements of vect2 are recycled to complete the operation of all elements of vect1.

Question: What is the difference between a data frame and a matrix in R Language?
Answer: In R, the data frame contains heterogeneous data (different columns of the data frame may have different types of variable) while a matrix contains homogeneous data (all the columns of the matrix have the same type of variable). In a matrix, similar data types can be stored while in a data frame, different types of data can be stored.

See Questions about R language Missing Values

MCQs General Knowledge, MCQs in Statistics

R Language: A Quick Reference Guide – IV

R Quick Reference Guide

Quick Reference Quide R Language

R language: A Quick Reference Guide about learning R Programming with a short description of the widely used commands. It will help the learner and intermediate user of the R Programming Language to get help with different functions quickly. This Quick Reference is classified into different groups. Let us start with R Language: A Quick Reference – IV.

This Quick Reference will help in performing different descriptive statistics on vectors, matrices, lists, data frames, arrays, and factors.

Basic Descriptive Statistics in R Language

The following is the list of widely used functions that are further helpful in computing descriptive statistics. The functions below are not direct descriptive statistics functions, however, these functions are helpful to compute other descriptive statistics.

R CommandShort Description
sum(x1, x2, … , xn)Computes the sum/total of $n$ numeric values given as argument
prod(x1, x2, … , xn)Computes the product of all $n$ numeric values given as argument
min(x1, x2, … , xn)Gives smallest of all $n$ values given as argument
max(x1, x2, …, xn)Gives largest of all $n$ values given as argument
range(x1, x2, … , xn)Gives both the smallest and largest of all $n$ values given as argument
pmin(x1, x2, …)Returns minima of the input values
pmax(x1, x2, …)Returns maxima of the input values

Statistical Descriptive Statistics in R Language

The following functions are used to compute measures of central tendency, measures of dispersion, and measures of positions.

R CommandShort Description
mean(x)Computes the arithmetic mean of all elements in $x$
sd(x)Computes the standard deviation of all elements in $x$
var(x)Computes the variance of all elements in $x$
median(x)Computes the median of all elements in $x$
quantile(x)Computes the median, quartiles, and extremes in $x$
quantile(x, p)Computes the quantiles specified by $p$

Cumulative Summaries in R Language

The following functions are also helpful in computing the other descriptive calculations.

R CommandShort Description
cumsum(x)Computes the cumulative sum of $x$
cumprod(x)Computes the cumulative product of $x$
cummin(x)Computes the cumulative minimum of $x$
cummax(x)Computes the cumulative maximum of $x$

Sorting and Ordering Elements in R Language

The sorting and ordering functions are useful in especially non-parametric methods.

R CommandShort Description
sort(x)Sort the all elements of $x$ in ascending order
sort(x, decreasing = TRUE)Sor the all elements of $x$ in descending order
rev(x)Reverse the elements in $x$
order(x)Get the ordering permutation of $x$

Sequence and Repetition of Elements in R Language

These functions are used to generate a sequence of numbers or repeat the set of numbers $n$ times.

R CommandShort Description
a:bGenerates a sequence of numbers from $a$ to $b$ in steps of size 1
seq(n)Generates a sequence of numbers from 1 to $n$
seq(a, b)Generates a sequence of numbers from $a$ to $b$ in steps of size 1, it is the same as a:b
seq(a, b, by=s)Generates a sequence of numbers from $a$ to $b$ in steps of size $s$.
seq(a, b, length=n)Generates a sequence of numbers having length $n$ from $a$ to $b$
rep(x, n)Repeats the elements $n$ times
rep(x, each=n)Repeats the elements of $x$, each element is repeated $n$ times
R Quick Reference Guide Frequently Asked Questions About R

R Language: A Quick Reference – I

https://gmstat.com

Important MCQs R Language Quiz 9

The post is about MCQ on R Language Quiz with Answers. The quiz covers the topics related to R Package qqplot, R Studio, and Data.Frame. Let us start with the MCQs R Language Quiz.

Online Multiple Choice Questions about Learning R Programming. It will help the learners to get knowledge of R not only for learning the language but also to get some practices about Statistics with reference to R Programming.

1. Which of the following are operations you can perform in ggplot2?

 
 
 
 

2. What does the data.frame function do in R?

 
 
 
 

3. Which statement about the ggsave() function is correct?

 
 
 
 

4. Which of the following are the benefits of using ggplot2?

 
 
 
 

5. Which package is associated with data visualization in R?

 
 
 
 

6. Which of the following aesthetics attributes can you map to the data in a scatterplot?

 
 
 
 

7. What is the role of the x argument in the following code?

ggplot(data = diamonds) +
       geom_bar(mapping = aes(x = cut))
 
 
 
 

8. What argument of the labs() function can a data analyst use to add text outside of the grid area of a plot?

 
 
 
 

9. What is the purpose of the rep() function in R?

 
 
 
 

10. In R studio, what default options does the Export functionality of the Plots tab give for exporting plots?

 
 
 
 

11. A data analyst is working with the penguin’s data. The analyst creates a scatterplot with the following code:

ggplot(data = penguins) +
       geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, alpha = species))

What does the alpha aesthetic do to the appearance of the points in the plot?

 
 
 
 

12. Which of the following is NOT a valid data structure in R?

 
 
 
 

13. When creating a plot in ggplot you must set the mapping argument of a function. Which function has the mapping argument?

 
 
 
 

14. Data frames can be converted to a matrix by calling data.

 
 
 
 

15. Which of the following are the benefits of adding labels and annotations to your plot?

 
 
 
 

16. Which ggplot function is used to define the mappings of variables to visual representations of data?

 
 
 
 

17. Which of the following are operations you can perform in ggplot2?

 
 
 
 

18. What function can you use to put a text label inside the grid of your plot to call out specific data points?

 
 
 
 

19. The _________ creates a scatterplot and then adds a small amount of random noise to each point in the plot to make the points easier to find.

 
 
 
 

20. In ggplot2, you use the plus sign (+) to add a layer to your plot.

 
 

MCQs R Language Quiz

  • Which of the following aesthetic attributes can you map to the data in a scatterplot?
  • What is the role of the x argument in the following code?
    ggplot(data = diamonds) +
    geom_bar(mapping = aes(x = cut))
  • Which of the following are the benefits of adding labels and annotations to your plot?
  • What function can you use to put a text label inside the grid of your plot to call out specific data points?
  • Which of the following are operations you can perform in ggplot2?
  • When creating a plot in ggplot you must set the mapping argument of a function. Which function has the mapping argument?
  • Which ggplot function is used to define the mappings of variables to visual representations of data?
  • Which of the following are the benefits of using ggplot2?
  • What argument of the labs() function can a data analyst use to add text outside of the grid area of a plot?
  • Which statement about the ggsave() function is correct?
  • A data analyst is working with the penguin’s data. The analyst creates a scatterplot with the following code:
    ggplot(data = penguins) +
    geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, alpha = species))
  • What does the alpha aesthetic do to the appearance of the points in the plot?
  • The ___________ creates a scatterplot and then adds a small amount of random noise to each point in the plot to make the points easier to find.
  • In R studio, what default options does the Export functionality of the Plots tab give for exporting plots?
  • Which of the following are operations you can perform in ggplot2?
  • In ggplot2, you use the plus sign (+) to add a layer to your plot.
  • Which of the following is NOT a valid data structure in R?
  • What is the purpose of the rep() function in R?
  • Which package is associated with data visualization in R?
  • What does the data.frame function do in R?
  • Data frames can be converted to a matrix by calling data.
Frequently Asked Questions About MCQs R Language Quiz

https://itfeature.com

https://gmstat.com