**R Programming Interview Questions and Answers**

**Q.Explain The Data Import In R Language.?**

**Ans:** R provides to import data in R language. To begin with the R commander GUI, user should type the commands in the command Rcmdr into the console.

**Data can be imported in R language in 3 ways such as:**

- Select the data set in the dialog box or enter the name of the data set as required.
- Data is entered directly using the editor of R Commander via Data->New Data Set. This works good only when the data set is not too large.
- Data can also be imported from a URL or from plain text file (ASCII), or from any statistical package or from the clipboard.

**Q.Explain How To Communicate The Outputs Of Data Analysis Using R Language.?**

**Ans:** Combine the data, code and analysis results in a single document using knitr for Reproducible research done. Helps to verify the findings, add to them and engage in conversations. Reproducible research makes it easy to redo the experiments by inserting new data values and applying it to different various problems.

**Q.What Is R?**

**Ans:** R is a programming language which is used for developing statistical software and data analysis.

**Q.How R Commands Are Written?**

**Ans:** By using # at the starting of the line of code like #division commands are written.

**Q.What Is T-tests() In R?**

**Ans:** It is used to determine that the means of two groups are equal or not by using t.test() function.

**Q.What Are The Disadvantages Of R Programming?**

**Ans:** **The disadvantages are:-**

- Lack of standard GUI
- Not good for big data.
- Does not provide spreadsheet view of data.

**Q.What Is The Use Of With () And By () Function In R?**

**Ans:** with() function applies an expression to a dataset.

**#with(data,expression)**

By() function applies a function t each level of a factors.

**#by(data,factorlist,function)**

**Q.In R Programming, How Missing Values Are Represented?**

**Ans:** In R missing values are represented by NA which should be in capital letters.

**Q.What Is The Use Of Subset() And Sample() Function In R?**

**Ans:** Subset() is used to select the variables and observations and sample() function is used to generate a random sample of the size n from a dataset.

**Q.Explain What Is Transpose.?**

**Ans:** Transpose is used for reshaping of the data which is used for analysis. Transpose is performed by t() function.

**Q.What Are The Advantages Of R?**

**Ans:** **The advantages are:-**

- It is used for managing and manipulating of data.
- No license restrictions
- Free and open source software.
- Graphical capabilities of R are good.
- Runs on many Operating system and different hardware and also run on 32 & 64 bit processors etc.

**Q.What Is The Function Used For Adding Datasets In R?**

**Ans:** For adding two datasets rbind() function is used but the column of two datasets must be same.

**Syntax:** rbind(x1,x2……) where x1,x2: vector, matrix, data frames.

**Q.How You Can Produce Co-relations And Covariances?**

**Ans:** Cor-relations is produced by cor() and covariances is produced by cov() function.

**Q.What Is Difference Between Matrix And Dataframes?**

**Ans:** Dataframe can contain different type of data but matrix can contain only similar type of data.

**Q.What Is Difference Between Lapply And Sapply?**

**Ans:** lapply is used to show the output in the form of list whereas sapply is used to show the output in the form of vector or data frame.

**Q.What Is The Difference Between Seq(4) And Seq_along(4)?**

**Ans**: Seq(4) means vector from 1 to 4 (c(1,2,3,4)) whereas seq_along(4) means a vector of the length(4) or 1(c(1)).

**Q.Explain How You Can Start The R Commander Gui.?**

**Ans:** rcmdr command is used to start the R commander GUI.

**Q.What Is The Memory Limit Of R?**

**Ans:** In 32 bit system memory limit is 3Gb but most versions limited to 2Gb and in 64 bit system memory limit is 8Tb.

**Q.How Many Data Structures R Has?**

**Ans:** There are 5 data structure in R i.e. vector, matrix, array which are of homogenous type and other two are list and data frame which are heterogeneous.

**Q.Explain How Data Is Aggregated In R.?**

**Ans:** There are two methods that is collapsing data by using one or more BY variable and other is aggregate() function in which BY variable should be in list.

**Q.How Many Sorting Algorithms Are Available?**

**Ans:** **There are 5 types of sorting algorithms are used which are:-**

- Bubble Sort
- Selection Sort
- Merge Sort
- Quick Sort
- Bucket Sort

**Q.How To Create New Variable In R Programming?**

**Ans:** For creating new variable assignment operator ‘<-’ is used For e.g. mydata$sum <- mydata$x1 + mydata$x2.
**Q.What Are R Packages?**

**Ans:** Packages are the collections of data, R functions and compiled code in a well-defined format and these packages are stored in library.

**Q.What Is The Workspace In R?**

**Ans:** Workspace is the current R working environment which includes any user defined objects like vector, lists etc.

**Q.What Is The Function Which Is Used For Merging Of Data Frames Horizontally In R?**

**Ans: **Merge()function is used to merge two data frames

**Eg:** Sum<-merge(data frame1,data frame 2,by=’ID’)
**Q.What Is The Function Which Is Used For Merging Of Data Frames Vertically In R?**

**Ans:** rbind() function is used to merge two data frames vertically.

**Eg.**

Sum<- rbind(data frame1,data frame 2)
**Q.What Is The Power Analysis?**

**Ans:** It is used for experimental design .It is used to determine the effect of given sample size.

**Q.Which Package Is Used For Power Analysis In R?**

**Ans:** Pwr package is used for power analysis in R.

**Q.Which Method Is Used For Exporting The Data In R?**

**Ans:** There are many ways to export the data into another formats like SPSS, SAS , Stata , Excel Spreadsheet.

**Q.Which Packages Are Used For Exporting Of Data?**

**Ans:** For excel xlsReadWrite package is used and for sas,spss ,stata foreign package is implemented.

**Q.How Impossible Values Are Represented In R?**

**Ans:** In R NaN is used to represent impossible values.

**Q.Which Command Is Used For Storing R Object Into A File?**

**Ans:** Save command is used for storing R objects into a file.

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

**Q.Which Command Is Used For Restoring R Object From A File?**

**Ans:** load command is used for storing R objects from a file.

**Syntax:** >load(”z.Rdata”)

**Q.What Is The Use Of Coin Package In R?**

**Ans:** Coin package is used to achieve the re randomization or permutation based statistical tests.

**Q.Which Function Is Used For Sorting In R?**

**Ans:** order() function is used to perform the sorting.

**Q.What Happens When The Application Object Does Not Handle An Event?**

**Ans:** The event will be dispatched to your delegate for processing.

**Q. Explain App Specific Objects Which Store The App Contents.?**

**Ans:** The app specific objects are Data model objects that store app’s contents.

**Q.Explain The Purpose Of Using Uiwindow Object?**

**Ans:** UIWindow object coordinates the one or more views presenting on the screen.

**Q.How To Create Axes In The Graph?**

**Ans:** Using axes() function custom axes are created.

**Q.What Is The Use Of Abline() Function?**

**Ans:** abline() function is add the reference line to a graph.

**Syntax:-**

abline(h=yvalues, v=xvalues)

**Q.Why Vcd Package Is Used?**

**Ans:** vcd package provides different methods for visualizing multivariate categorical data.

**Q.What Is Ggobi?**

**Ans:** GGobi is an open source program for visualization for exploring high dimensional typed data.

**Q.What Is Iplots?**

**Ans:** It is a package which provide bar plots, mosaic plots, box plots, parallel plots, scatter plots and histograms.

**Q.What Is The Use Of Lattice Package?**

**Ans:** lattice package is to improve on base R graphics by giving better defaults and it have the ability to easily display multivariate relationships.

**Q.What Is Fitdistr() Function?**

**Ans:** It is used to provide the maximum likelihood fitting of univariate distributions. It is defined under the MASS package.

**Q.Which Data Structures Are Used To Perform Statistical Analysis And Create Graphs.?**

**Ans:** Data structures are vectors, arrays, data frames and matrices.

**Q.What Is The Use Of Sink() Function?**

**Ans:** It defines the direction of output.

**Q.Why Library() Function Is Used?**

**Ans:** This function is used to show the packages which are installed.

**Q.Why Search() Function Is Used?**

**Ans:** By this function we see that which packages are currently loaded.

**Q.On Which Type Of Data Binary Operators Are Worked?**

**Ans:** Binary operators are worked on matrices, vectors and scalars.

**Q.What Is The Use Of Doby Package?**

**Ans:** It is used to define the desired table using function and model formula.

**Q.Which Function Is Used To Create Frequency Table?**

**Ans:** Frequency table is created by table() function.

**Q.What Is The Of Use Matrix Package?**

**Ans:** Matrix package includes those function which support sparse and dense matrices like Lapack, BLAS etc.

**Q.Define Matlab Package.?**

**Ans:** Matlab package includes those wrapper functions and variable which are used to replicate matlab function calls.

**Q.What We Use Party Package?**

**Ans:** It is used to provide a non-parametric regression for ordinal, nominal, censored and multivariate responses.

**Q.Define Cluster.stats() ?**

**Ans:** It is define in fpc package which provide a method for comparing the similarity of two clusters solution using different validation criteria.

**Q.What Is Pvclust() Function?**

**Ans**: It comes under the pvclust package which provides p-values for hierarchical clustering.

**Q.Which Function Performs Classical Multidimensional Scaling?**

**Ans:** cmdscale() function is used to perform classical multidimensional scaling.

**Q.What Is The Use Of Boot.sem() Function?**

**Ans:** It is used to bootstrap the structural equation model.

**Q.What Is Factominer?**

**Ans:** It is a package which includes quantitative and qualitative variables. It also includes supplementary variables and observations.

**Q.What Is Principal() Function?**

**Ans:** It is define in psych package which is used to rotate and extract the principal components.

**Q.Define Auto.arima().?**

**Ans:** It is used to handle the seasonal as well as non-seasonal ARIMA models.

**Q.What Is The Use Of Forecast Package?**

**Ans:** It provides the functions which are used for automatic selection of ARIMA and exponential models.

**Q.Define Lda().?**

**Ans:** lda() is used to print the discriminant functions which is based on centered variable.

**Q.What Is The Use Of Mass Package?**

**Ans:** MASS functions include those functions which performs linear and quadratic discriminant function analysis.

**Q.What Is Coxph()?**

**Ans:** It is a function which is used to model the hazard function on the set of predictor variable.

**Q.Define Survival Analysis.?**

**Ans:** It includes number of techniques which is used for modeling the time to an event.

**Q**.**Define Poison Regression.?**

**Ans:** It is used to predict the outcome variable which represents counts from the given set of continuous predictor variable.

**Q.What Is Logistic Regression?**

**Ans:** Logistic regression is used to predict the binary outcome from the given set of continuous predictor variables.

**Q.Which Variables Are Represented By Upper Case Letters?**

**Ans:** Categorical factors are represented by upper case letters.

**Q.Which Variables Are Represented By Lower Case Letters?**

**Ans:** Numerical variables are represented by lower case letters.

**Q.Define Barlett.test().?**

**Ans:** Barlett.test() is used to provide a parametric k-sample test of the equality of variances.

**Q.What Is Fligner.test()?**

**Ans:** It is a function which provides a non-parametric k sample test of the equality of variances.

**Q.What Is The Use Of Manova?**

**Ans:** By using MANOVA we can test more than one dependent variable simultaneously.

**Q.Define Plotmeans().?**

**Ans:** It is define under gplots package which includes confidence intervals and it produces mean plot for single factors.

**Q.What Is Robustbase?**

**Ans:** It is a package which provides basic robust statistics including model selection methods.

**Q.Why Car Package Is Used?**

**Ans:** It provide a variety of regression including scatter plots, variable plots and it also enhanced diagnostic.

**Q.Define Relaimpo Package.?**

**Ans:** It is used to measure the relative importance of each of the predictor in the model.

**Q.Define Stepaic() Function.?**

**Ans:** It is define under the MASS package which performs stepwise model selection under exact AIC.

**Q.What Is The Use Of Diagnostic Plots?**

**Ans:** It is used to check the normality, heteroscedasticity and influential observations.

**Q.What Is Npmc?**

**Ans:** It is a package which gives nonparametric multiple comparisons.

Contact for more on R Programming Online Training

## R Programming interview questions Tags:

r programming interview questions and answers, r programming online training, r programming interview questions, r programming training online, r programming training, r programming training institute, latest r programming interview questions, best r programming interview questions 2019, top 100 r programming interview questions,sample r programming interview questions,r programming interview questions technical, best r programming interview tips, best r programming interview basics, r programming Interview techniques,r programming Interview Tips.