In case you’re searching for R Programming Interview Questions and answers for Experienced or Freshers, you are at the correct place. There is parcel of chances from many presumed organizations on the planet. The R Programming advertise is relied upon to develop to more than $5 billion by 2020, from just $180 million, as per R Programming industry gauges. In this way, despite everything you have the chance to push forward in your vocation in R Programming Development. Gangboard offers Advanced R Programming Interview Questions and answers that assist you in splitting your R Programming interview and procure dream vocation as R Programming Developer.

### Best R Programming Interview Questions and Answers

Do you believe that you have the right stuff to be a section in the advancement of future R Programming, the GangBoard is here to control you to sustain your vocation. Various fortune 1000 organizations around the world are utilizing the innovation of R Programming to meet the necessities of their customers. R Programming is being utilized as a part of numerous businesses. To have a great development in R Programming work, our page furnishes you with nitty-gritty data as R Programming prospective employee meeting questions and answers. R Programming Interview Questions and answers are prepared by 10+ years experienced industry experts. R Programming Interview Questions and answers are very useful to the Fresher or Experienced person who is looking for a new challenging job from the reputed company. Our R Programming Questions and answers are very simple and have more examples for your better understanding.

By this R Programming Interview Questions and answers, many students are got placed in many reputed companies with high package salary. So utilize our R Programming Interview Questions and answers to grow in your career.

#### Q1) What are all the operators in R?

- Arithmetic Operators
- Rational Operators
- Logical Operators
- Assignment operators

#### Q2) What are all the arithmetic operators?

Addition, Subtraction, Multiplication, Division are the basic arithmetic operators. In R, it is generally used to declare using with same representations as +, -, *, / respectively. Apart from this, we have %%, which gives the remainder value & ^ to an exponent.

#### Q3) What are all the relational operators?

<, >, <=, >= ==, != are the relational operators where the first vector is against the second vector in R.

#### Q4) What are all the Logical operators?

R supports 3 Logical operators. Where & refers the AND operator, | refers the OR operator and ! represents the NOT operator.

#### Q5) What are all the assignment operators?

Assignment operators have 2 ideas of assignment. Left assignment operators & Right assignment operators. = cannot be used as the right assignment operator.

Left assignment operators are: <- | <<- | =

Right assignment operators are: -> | ->>

#### Q6) What does: colon operator refers to?

It helps to create a sequence. When a sequence has to be declared, : operator is being utilized.

Example: 1:10, will result in 1 2 3 4 5 6 7 8 9 10.

#### Q7) What are all the decision statements in R?

IF, IF_ELSE, Switch are the 3 decision statements in R.

#### Q8) What are all the Loops in R?

In R, we have FOR, WHILE & REPEAT loops. Loops help to make the certain executions repetitive for the given conditions.

#### Q9) Is R a General-Purpose Language?

- R is a statistical language which is hardcore for any statistical analysis. It doesn’t support general developments like other languages, such as Python & Java.

#### Q10) How can be a vector is represented in R?

A vector can be of any dimensions. Even any variables saved with 1 value, it becomes a vector. Greater than 1 dimension, vectors can be created using the function c().

Example: A = 1:5 results 1 2 3 4 5. A = c(1,2) results 1 2.

#### Q11) Is it possible to declare multiple data types within a vector in R?

No, the data types will be coerced. If it is a vector with few numeric data points and if any one data point is a character, vector will be coerced to character data type.

#### Q12) Do the Arithmetic operations are possible in a vector?

Yes, all arithmetic operations are possible in a vector.

#### Q13) How will the two vectors of different lengths will be applied in any arithmetic operations?

If the two vectors are of unequal lengths, the vector which is less in length will be repeated until the operation is getting performed.

Example: a = c(1,2) | 1 2 # a becomes 1 2 1 2

b = c(3:6) | 3 4 5 6

a+b | 4 6 6 8

#### Q14) What does DMwR package does?

DMwR stands for Data Manipulation with R. Where this package is one of the widely used package for any data manipulations.

#### Q15) What is the package used for data operations?

Lubridate. This package is widely used for any data analysis on the date. It includes dates processing of seconds, minutes & hours with predefined functions of s, m, and h respectively.

#### Q16) Is the list mutable in R?

Yes, a list is editable in R. List is one of the widely used objects in R. Where it can have multiple data types within one list. Not like vector, which doesn’t support multiple data types within one vector. List can have a list within a list.

#### Q17) Is it possible to convert a list to a vector?

Yes. A list can be converted into a vector. UNLIST is a predefined function which converts a list to the vector. This function delists a list and produces output as a vector.

Example: sample_List = list(1:5) | [1] 1 2 3 4 5

unlist(sample_list) | 1 2 3 4 5

#### Q18) What is difference between matrix & Data frame?

Matrix & Data frame has a similar structural object. But data frame can have different data types in the different column. Where matrix cannot have different data types.

#### Q19) Do matrix support arithmetic operations?

Yes, all arithmetic operations are possible in a matrix.

#### Q20) What is the factor in R?

Factor is an object in R, which converts a vector to a categorizable object level. Which it can have N levels.

#### Q21) what are all the functions used to get the structure & summary of the data frames?

- str() – Will get the structure of the data frame
- summary() – will give you the summary of the data frame. The summary function gives you the MIN, MAX, MEAN, 1
^{st}, 2^{nd}, 3^{rd}

#### Q22) How to merge two different data frames by row & column level to the data frame in R?

rbind() – It merges the two data frames by row level in the data

cbind() – It merges the two different data frames by column level in the data.

#### Q23) Explain MAX & MIN function.

MAX – It will give you the maximum value of the data. Eg: max(data_frame$Column_name)

MIN – It will give you the minimum value of the data. Eg: min(data_frame$Column_name)

#### Q24) How to read/write a CSV file in R?

read_csv() – this function reads the data to R.

write.csv() – this function writes the data from R.

#### Q25) Can we connect MySQL with R?

Yes, dbConnect() – function can be used to connect the MySQL.

dbSendQuery() – this function helps SQL query to be applied in R to get those query results in R.

#### Q26) Name the data structures in R?

- Vector
- List
- Array
- Matrix
- Tables
- Data frame

#### Q27) What are all the advantages of a MarkDown file?

RMD files help to create a better reporting portable code file.

RMD helps to generate the HTML file which can be transferred which doesn’t demand data for processing.

#### Q28) What is R-Shiny?

R shiny is a package which helps to generate the web application from R. It does support the CSS, Java-script integrations.

#### Q29) How to calculate the character count of a variable or in a vector?

str_count() – this function helps to count the number of strings in the variable or in the vector.

#### Q30) What are the functions to calculate mean, median & mode in R?

mean() – this function calculates mean value.

median() – this function calculates the median value.

Unlike mean & median, we don’t have a pre-defined function in R for Mode. We must derive it for our own.

#### Q31) How can we apply Linear regression in R?

lm() – this function helps us to build a linear regression model, which results from the slope and intercept values of the model.

#### Q32) Which package do the lm() function uses?

Linear regression function(lm()) uses stats package in R. Linear regression included in the machine learning family, but it is just a statistical idea, where it helps to predict. Technically it is not a machine learning model.

#### Q33) How to create a scatter plot in R?

plot(x,y) – this function will create a scatter plot in R. It needs to get 2 parameters given, both should be numeric.

#### Q34) Can the normal vector can be parsed to a time series model?

No, normal data cannot parse directly. Data has to be converted into a time series data using ts() function in R.

#### Q35) Is it possible to do joins in R? if yes, name the functions.

Yes, Join functions are possible in R.

- left_join() – this performs the left join
- right_join() – this performs the right join
- inner_join() – this performs the inner join
- full_join() – this performs the full join

#### Q36) How to get the column names of a data frame in R?

colnames() – this function will result from the column names of a data frame.

#### Q37) What is the memory limitation of R?

R will support 3GB memory if it is a 32-bit processor and it is a 64-bit processor, It does support till 8TB.

Q38) What correlation is being used in R? what is the function to get a correlation in R?

R uses Pearson correlation in default. Cor() – function gives the correlation between the columns. Pearson correlation cannot be applied for a categorical column.

#### Q39) Do R support reverse indexing?

No, R doesn’t support reverse indexing. Rather, if you use – with index, it drops it.

#### Q40) What is the difference between install.packages() & installed.packages() in R?

Install.packages() – will install package to your local system from CRAN/Git.

installed.packages() – will give the list of packages that have been installed in a local system.

#### Q41) Is it possible to do arithmetic operations between a vector & a list in R?

No, it is not possible to do arithmetic operations between two different data types. It will result in the error.

#### Q42) What is the difference between the array and the matrix?

All Matrix can be called as the array, but all array cannot be called as Matrix. It is because that, a matrix will always have a 2 dimension, where the array can have any dimension in nature.

Q43) How to create a logistic regression model in R?

GLM() – this function builds a logistic model, we have to make sure the family parameter is BINOMIAL. Because GLM stands for Generalised Linear Models. Where this function can perform other generalized models like Gaussian.

#### Q44) What are all the functions for performing a Kmeans & Kmeans-Plus plus Clustering algorithms?

Kmeans() – Performs Kmeans algorithm for the given data, K parameter is a mandate.

KmeansPP() – performs Kmeans-Plus-plus algorithm. K parameter is a mandate.

Q45) Name some packages which can be used to perform different algorithms in R?

- randomForest – To build a random Forest algorithm
- rpart – To build a CART algorithm
- C50 – To build a C5.0 algorithm
- naive Bayes – To build a Naïve Bayes algorithm
- XP boost – To build an XG boost Algorithm
- fastAdaboost – To build a Ada Boost algorithm
- stats – To build both Linear & Logistic regression, models

#### Q46) Is it possible to do a Data transpose in R?

Yes, we can do transpose the data in R. t() – function will transpose the data in R.

#### Q47) How to identify the number if missing values in a data frame in R?

is.na() function will result whether the data point is NA or not. To sum it up and get the number of missing values, we can use both sum & is.na function together to achieve it.

sum(is.na(data_frame)) will result from the number of NA values in the data frame.

#### Q48) Is it possible to import a text file in R?

Yes, you can use read.table() function from utils package to import it.

#### Q49) What are all the different ways of sub-setting data in R?

[] – subsets with Index valuessubset() – performs with the given condition, includes row names in results

filter() – performs with given condition, excludes row names in results

select() – performs with the conditions, similar to SQL select statement

#### Q50) How to set a working directory and to get the path of it?

setwd() – function sets the current working directory

getwd() – function gets the path of the working directory.

## No Comments