# Top 33 R Interview Questions

**Introduction**

The top 33 R interview questions blog includes some of the frequently asked questions that one is most likely to encounter in his interview for the R language-related jobs.

Let’s delve into R programming interview questions along with the suggested answers.

### Que 1: What is R

R is an open-source programming language or an environment used for data sciences. It is widely used by data miners for statistical analysis, graphics, data modeling, reporting, and machine learning algorithm.

### Que 2: What are some of the advantages of R?

R’s open-source nature makes it easily accessible, its built-in functionality via R packages makes it easy for users, and its graphical and statistical capabilities are unmatched.

### Que 3: What are some of the disadvantages of R programming?

It doesn’t have a standard GUI, it doesn’t provide a spreadsheet view of the data, and is not apt for big data.

### Que 4: How are R commands written?

R commands are written by using # at the starting of the code line.

### Que 5: Name the different objects or data types used in R.

Homogeneous data types – vectors, matrices, arrays

Heterogeneous data types -Lists and data frames

### Que 6: What is the difference between R and Python in terms of functionality?

R has better visualization tools and libraries whereas Python is considered more secure and easier to learn.

### Que 7: How are missing and impossible values represented in R?

NA is used to represent the missing values and NaN is used to represent impossible values.

### Que 8: What is the workspace in R?

The current R working environment includes user-defined objects like lists, vectors, etc.

### Que 9: What is the memory limit in R?

8TB for 64-bit system memory and 3GB for 32-bit system memory.

### Que 10: How do you import data in R?

Using CSV as an example which is a common data format, save the file in the CSV format and use the read function to read the data.

“read.csv()” and specify the path of the file

### Que 11: Name different types of sorting algorithms available in R.

There are 5 of them – Bubble Sort, Selection Sort, Merge Sort, Quick Sort, and Bucket Sort.

### Que 12: What are R packages and how are they installed?

In R, a package is the fundamental unit of shareable code. It is a collection of R functions, compiled code and data sets and stored under a directory named ‘library’.

They are installed using the install command

Install.packages(“package name”)

### Que 13: Name some of the packages used for data imputation?

MICE, misFores, Mi, Hmisc, Amelia are some of the data packages used for data imputation.

### Que 14: Could you explain the difference between sample() and subset() in R.

The sample() is used to choose a random sample size from a dataset whereas the subset method is used to choose variables and observations.

### Que 15: How do you call a function in R?

A function in R can be called by using the position or name of an arguments or by calling the default arguments.

### Que 16: How do you assign a variable in R?

Assigning variables is a little different from other languages. We use < (less than) sign followed by – (minus) sign as opposed to = (equal to) sign.

### Que 17: What are some of your favorite functions in R?

As an expert, you should be able to respond with some functions on the spot.

### Que 18: Explain the use of with() and by() function in R.

with() applies the expression to a dataset .

by() applies function to each level of factors.

### Que 19: Which function do you use to add datasets in R?

2 data frames having the same variables can be joined using rbind() function.

### Que 20: Why would one use a factor variable?

A factor variable is used to store categorical values. It is more memory efficient and can be used for statistical modelling with greater accuracy.

### Que 21: Can you differentiate between matrix and data frames?

Matrix contains similar type of data while data frames contain different data types.

### Que 22: Why is apply family of functions used in R?

Apply function is used to edit every entry of data frames and matrices using a single line command.

### Que 23: What do you mean by transpose?

Transpose means reshaping of data which is used for analysis and t() is used for the same.

### Que 24: When do you use the next statement in R?

Next is used in the loop statements to skip the current iteration without terminating the loop.

### Que 25: What does a runif() function do in R?

Generate random numbers from a uniform distribution.

### Que 26: What function is used for joining multiple strings together?

Paste() or string_c()

### Que 27: What do you understand by t-tests in R?

T-test is the most common test in statistics and used to determine whether the means of two groups are equal to each other and t.test() is used for the same.

### Que 28: How will you replace all the missing values of a vector v with the sum of elements of that vector?

Function(v) { v[is.na(v)] <- sum(v, na.rm = TRUE); v}

### Que 29: How do you list down the data sets available in all the packages?

data(package=.packages(all.available=TRUE))

### Que 30: What function is used to create axes in the graph?

Custom axes are created using the axes() function.

### Que 31: What is the uses of shiny R package?

It’s a package used to build interactive web apps straight from the R.

### Que 32: Why is doBY package used?

It is used to define the desired table using model formula and function

### Que 33: How do you define correlation and how does one measure it in R?

Correlation can be defined as the degree of the linear relationship between two variables.

cor() is used to measure the same.

**Conclusion**

The above list of **R interview questions** is designed to prepare you for the ever-growing demand of the R certified professionals.

It is also important to find the right place to learn and become proficient in all these skills and languages. Jigsaw Academy, recognized as one of the Top 10 Data Science Institutes in India, is the right place for you. Jigsaw Academy offers an Integrated Program In Business Analytics for enthusiasts in this field. The course runs for 10 months and is conducted live online. Learners are offered a joint certificate by the Indian Institute of Management, Indore, and Jigsaw Academy.