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.
Table of Contents
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