Grab Deal : Flat 20% off on live classes + 2 free self-paced courses! - SCHEDULE CALL

- Data Science Blogs -

# R Programming Language Interview Questions & Answers

## R Programming Language Interview Questions & Answers

Here, in this post, we are going to discuss top questions for R programming language. We have divided the questions into two categories one is for fresher and other for experienced one. As R is one of the most popular programming languages for Big Data professionals. There is a huge requirement of R programmers in the market and this article covers the concepts and usually asked interview questions to R programmers by the interviewers.

## R interview questions and answers for freshers

#### Q1). Explain R, what is R?

R programming language is used for data analysis and to develop statistical software. R programming language is also used for machine learning purpose and applications.

#### Q2). Write syntax for R programming or R commands?

While writing R command you should start the line with #, like the commands are written as #division.

#### Q3). How can we convey data analysis result through R language?

The user can combine the result of data, code, and analysis in a single document and the processed data can be used by the users to perform reproducible research. In this way, the user can verify the result and engage in many discussions. Through such reproducible research, the experiments can be done easily and applied to different problems.

#### Q4). List the data structures used in R programming?

There are two data structures in R programming one is Homogeneous and other is Heterogeneous. When the same type of objects is to be used then homogeneous data structures are used as for Vectors, Array and Matrix. Even for different object types, we can use Heterogeneous data structures like to store data frames and lists.

#### Q5). What is the value of f(2) for the following code?

a<-4

f <- function (b)

{

a<- 3

a^3 + g (b)

}

Read: Latest Data Science Course Syllabus: Mastering Data Science

g<-function (b)

{a*b}

Here in the above function, value 2 will be passed to the function, which is for variable “b” and value of variable “a” will be is defined in function f(b) is 3. So, the output of the above program will be 3^3+g(2). In the above code, the value of function g is global and it takes value 4 rather than 3 and will return the value 2*4 -8 to the function f. Here, the effective result will be 3^3+8=35

#### Q6). How can we create a table using R language without using external files?

The following syntax can be used to create a table in R language:

NewTable=data.frame()

Edit(NewTable)

Through above code a new Excel Spreadsheet so that you can enter the values in NewTable. In this way, a new table can be created.

#### Q7). Compare R and Python languages for Predictive Modelling?

Following table enlist the comparison for R and Python languages:

 Programming Language R Programming Language Python Model Building like Python R Like Model Building Interoperability of Model is good Interoperability is not good Production not like Python Better production than R Good Community Support for Python Not Better Community Support than R Similar Data Science library as for Python Similar Libraries as R for Data Science Good data visualization tools and libraries Not better data visualization than R The steep learning curve of R Easier learning curve than R

#### Q8). What is data import in R language?

The user can import data in R language. R commander GUI is used to type the commands, also known as Rcmdr, which is like a console.

In following three ways we can import data into R:

Read: Unlock the Advanced Power of Augmented Analytics in Data Science: A Transformative Fusion
• After selecting data set from the dialog box, you can enter the data set name as required.
• Data can also be entered directly through R command Here the options are Data-> New Data Set. If the data set is not very large then this option can be feasible.
• The user can import the data either directly from URL or from plain ASCII file or from the statistical package or from the clipboard.

#### Q9). Define t-tests() of R.

T.tests() is a function which is used to determine the means of two groups and to check their equality.

#### Q10). List disadvantages of R programming?

R programming has following disadvantages:

• It does not have standard GUI
• It is not considered good language for big data
• R programming does not provide tabular or spreadsheet view of data.

#### Q11). What is the use of by() and with() function in R?

These are two functions of R language that are used for the following purposes:

• The function with() is applied to the dataset expression and the syntax is: #with(data, expression)
• The function by () can be applied to each level of factors. The syntax is as follows: #by(data, factor list, function)

### R interview questions and answers for Experienced

#### Q12). How can we represent the missing values in R programming?

Missing values can be represented by NA in R programming, it should be written in capital letters.

#### Q13). What are the advantages of R programming language?

R programming language has following advantages:

• There are no license restrictions in R programming language
• It is open source and freely available software
• R programming has many graphical capabilities
• It can be run on many hardware and operating system and on 32 and 64-bit processors

#### Q14). Enlist the addition function used in R language?

To add two datasets there is two functions rbind() function, through which we can add the column values of two data sets.

The syntax is as follows:

Syntax: rbind(x1,x2,----) where x1, x2: vector, matrix, data frames

#### Q15). Explain the difference between require () and library ()functions in R language.

The two popular and most R functions are required () and library(). These are two different functions which have following properties:

 Require() Function Library() Function The user can use this function inside another function and throws a warning message when a particular package is not found in the language. Library() function display an error message in case if the package cannot be loaded or not found in R language? It checks loading of a function and a message is displayed stating that the function cannot reload any already loaded function. Without checking it just reloads the packages whether it is loaded or not.

#### Q16). What is the limit for memory in R?

In case of the 32-bit system the memory limit is 3GB while in case of the 64-bit system the limit is 8Tb.

#### Q17). List sorting algorithms of R.

In R there are mainly following 5 types of the algorithm:

• Bucket Sort
• Merge Sort
• Quick Sort
• Bucket Sort
• Selection Sort

#### Q18). Which packages are used to store and restore R objects to and from a file in R language?

To store an object in a file we can use Save command and the syntax for this is as:

Read: Data Science Career Path: Your Roadmap to Become Data Scientist Pro

Syntax: > save(z,file=”z.Rdata”)

While to restore R object we can use the following command:

Syntax:> load(“z.Rdata”)

#### Q19). Why are the VCD and lattice packages used?

Through vcd package, we can visualize multivariate categorical data. Lattice package is used to improve R graphics and better defaults are given to the package. We can display multivariate relationship.

#### Q20). What is the use of sink(), Library () and search() function?

These functions are used for the following purposes:

• Sink(): It defines the output direction i.e. where the output will reach?
• Library(): It can be used to show installed packages
• Search(): This function can display the currently loaded packages

#### Q21). Why the function anova(), cv.Im(), stepAIC()?

We can use above functions for the following tasks:

• Anova(): Function is used to compare the nested models
• lm(): The function is defined under DAAG package and is used fork-fold validation
• stepAIC(): The function is defined by the MASS package and can perform stepwise model selection under exact AIC.

#### Q22). Why the relaimpo, car and robust packages are used?

The functions are used for following purposes:

• Relaimpo: The function is used to predict the relative importance of the model.
• Car: A variety of regressions are provided by this package including scatter plots and variable plots.
• Robust: A library of robust methods including regression is used.

#### Q23). Write the full form MANOVA and why is it used?

Full form of MANOA is a multivariant analysis of variance. Through this function, we can test more than one dependent variable. We can check them simultaneously.

#### Q24). Define barlett.test(), finger.test() and hovplot()functions.

Above listed functions have following functionalities:

• test()->This function is used is used to provide a parametric k-sample test to check the variance of equality.
• test()->It can be used to send non-parametric k sample test to ensure variance of equality.
• Hovplot()-> This function is defined in HH package and the function is defined to conduct graphics test for homogeneity.

#### Q25). What is logistic and Poison regression?

Above regressions are used for following functionalities:

• Logistic Regression: This regression is used to predict binary outcome from the given set of variables which are continuous in nature.
• Poison Regression: This regression can predict the outcome variable from the given set of continuous variable sets.

Read: Top 15 Data Mining Applications to Dominate 2023 {The Complete List}

### Data Science Tutorial Overview

#### Interview

FaceBook Twitter Google+ LinkedIn Pinterest Email

### JanBask Training

A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.

### Trending Courses

Cyber Security

• Introduction to cybersecurity
• Cryptography and Secure Communication
• Cloud Computing Architectural Framework
• Security Architectures and Models

Upcoming Class

-1 day 13 Apr 2024

QA

• Introduction and Software Testing
• Software Test Life Cycle
• Automation Testing and API Testing
• Selenium framework development using Testing

Upcoming Class

5 days 19 Apr 2024

Salesforce

• Salesforce Configuration Introduction
• Security & Automation Process
• Sales & Service Cloud
• Apex Programming, SOQL & SOSL

Upcoming Class

4 days 18 Apr 2024

Business Analyst

• BA & Stakeholders Overview
• BPMN, Requirement Elicitation
• BA Tools & Design Documents
• Enterprise Analysis, Agile & Scrum

Upcoming Class

13 days 27 Apr 2024

MS SQL Server

• Introduction & Database Query
• Programming, Indexes & System Functions
• SSIS Package Development Procedures
• SSRS Report Design

Upcoming Class

5 days 19 Apr 2024

Data Science

• Data Science Introduction
• Hadoop and Spark Overview
• Python & Intro to R Programming
• Machine Learning

Upcoming Class

12 days 26 Apr 2024

DevOps

• Intro to DevOps
• GIT and Maven
• Jenkins & Ansible
• Docker and Cloud Computing

Upcoming Class

-1 day 13 Apr 2024

Hadoop

• Architecture, HDFS & MapReduce
• Unix Shell & Apache Pig Installation
• HIVE Installation & User-Defined Functions
• SQOOP & Hbase Installation

Upcoming Class

6 days 20 Apr 2024

Python

• Features of Python
• Python Editors and IDEs
• Data types and Variables
• Python File Operation

Upcoming Class

-1 day 13 Apr 2024

Artificial Intelligence

• Components of AI
• Categories of Machine Learning
• Recurrent Neural Networks
• Recurrent Neural Networks

Upcoming Class

13 days 27 Apr 2024

Machine Learning

• Introduction to Machine Learning & Python
• Machine Learning: Supervised Learning
• Machine Learning: Unsupervised Learning

Upcoming Class

5 days 19 Apr 2024

Tableau

• Introduction to Tableau Desktop
• Data Transformation Methods
• Configuring tableau server
• Integration with R & Hadoop

Upcoming Class

6 days 20 Apr 2024

Search Posts

Receive Latest Materials and Offers on Data Science Course