Top R Interview Questions And Answers
Here are top 100 objective type sample R interview questions and their answers are given just below to them. These sample questions are framed by experts from Intellipaat who trains for R Programming training
to give you an idea of type of questions which may be asked in interview. We have taken full care to give correct answers for all the questions. Do comment your thoughts Happy Job Hunting!
Wish to Learn R Programming? Click Here
Top Answers to R Interview Questions
2. How R commands are written?
By using # at the starting of the line of code like #division commands are written.
3.What is t-tests() in R?
It is used to determine that the means of two groups are equal or not by using t.test() function.
4.What are the disadvantages of R Programming?
The disadvantages are:-
• Lack of standard GUI
• Not good for big data.
• Does not provide spreadsheet view of data.
5.What is the use of With () and By () function in R?
with() function applies an expression to a dataset.
By() function applies a function t each level of a factors.
Wish to Learn R Programming? Click Here
6. In R programming, how missing values are represented?
In R missing values are represented by NA which should be in capital letters.
7.What is the use of subset() and sample() function in R?
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.
8. Explain what is transpose?
Transpose is used for reshaping of the data which is used for analysis. Transpose is performed by t() function.
9.What are the advantages of R?
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.
10. What is the function used for adding datasets in R?
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.
11.How you can produce co-relations and covariances?
Cor-relations is produced by cor() and covariances is produced by cov() function.
12.What is difference between matrix and dataframes?
Dataframe can contain different type of data but matrix can contain only similar type of data.
13.What is difference between lapply and sapply?
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.
14. What is the difference between seq(4) and seq_along(4)?
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)).
15. Explain how you can start the R commander GUI?
rcmdr command is used to start the R commander GUI.
16. What is the memory limit of R?
In 32 bit system memory limit is 3Gb but most versions limited to 2Gb and in 64 bit system memory limit is 8Tb.
17.How many data structures R has?
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.
18. Explain how data is aggregated in R?
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.
19. How many sorting algorithms are available?
there are 5 types of sorting algorithms are used which are:-
• Bubble Sort
• Selection Sort
• Merge Sort
• Quick Sort
• Bucket Sort
20.How to create new variable in R programming?
For creating new variable assignment operator ‘<-’ is used
For e.g. mydata$sum <- mydata$x1 + mydata$x2
21.What are R packages?
Packages are the collections of data, R functions and compiled code in a well-defined format and these packages are stored in library.
22.What is the workspace in R?
Workspace is the current R working environment which includes any user defined objects like vector, lists etc.
23.What is the function which is used for merging of data frames horizontally in R?
Merge()function is used to merge two data frames
Eg. Sum<-merge(data frame1,data frame 2,by=’ID’).
24.what is the function which is used for merging of data frames vertically in R?
rbind() function is used to merge two data frames vertically.
Sum<- rbind(data frame1,data frame 2)
25.What is the power analysis?
It is used for experimental design .It is used to determine the effect of given sample size.
26.Which package is used for power analysis in R?
Pwr package is used for power analysis in R.
27.Which method is used for exporting the data in R?
There are many ways to export the data into another formats like SPSS, SAS , Stata , Excel Spreadsheet.
28.Which packages are used for exporting of data?
For excel xlsReadWrite package is used and for sas,spss ,stata foreign package is implemented.
29. How impossible values are represented in R?
In R NaN is used to represent impossible values.
30.Which command is used for storing R object into a file?
Save command is used for storing R objects into a file.
31. Which command is used for restoring R object from a file?
load command is used for storing R objects from a file.
32.What is the use of coin package in R?
coin package is used to achieve the re randomization or permutation based statistical tests.
33.Which function is used for sorting in R?
order() function is used to perform the sorting.
34.What is the use of tapply?
35.What happens when the application object does not handle an event?
the event will be dispatched to your delegate for processing.
36.Explain app specific objects which store the app contents?
Data model objects are app specific objects and store app’s content. Apps can also use document objects.
37.Explain the purpose of using UIWindow object?
UIWindow object coordinates the one or more views presenting on the screen.
38.Tell me the super class of all view controller objects?
UIView Controller class.
39.How to create axes in the graph?
Using axes() function custom axes are created.
40.What is the use of abline() function?
abline() function is add the reference line to a graph.
41.Why vcd package is used?
vcd package provides different methods for visualizing multivariate categorical data.
42. What is GGobi?
GGobi is an open source program for visualization for exploring high dimensional typed data.
43.What is iPlots?
It is a package which provide bar plots, mosaic plots, box plots, parallel plots, scatter plots and histograms.
44.What is the use of lattice package?
lattice package is to improve on base R graphics by giving better defaults and it have the ability to easily display multivariate relationships.
45. What is fitdistr() function?
It is used to provide the maximum likelihood fitting of univariate distributions. It is defined under the MASS package.
46.Which data structures are used to perform statistical analysis and create graphs.
Data structures are vectors, arrays, data frames and matrices.
47.What is the use of sink() function?
It defines the direction of output.
48. Why library() function is used?
This function is used to show the packages which are installed.
49.Why search() function is used?
By this function we see that which packages are currently loaded.
50. On which type of data binary operators are worked?
Binary operators are worked on matrices, vectors and scalars.
51. What is the use of doBY package?
It is used to define the desired table using function and model formula.
52. Which function is used to create frequency table?
Frequency table is created by table() function.
53.Define loglm() function.
Loglm() function is used to create log-linear models.
54.What is the use of corrgram() function?
corrgram() function is used to plot correlograms.
55.How to create scatterplot matrices?
Pair() or splom() function is used for create scatterplot matrices.
56. What is npmc?
It is a package which gives nonparametric multiple comparisons.
57. What is the use of diagnostic plots?
It is used to check the normality, heteroscedasticity and influential observations.
58.Define anova() function.
anova() is used to compare the nested models.
59.What is cv.lm() function?
It is defined under the DAAG package which is used for k-fold validation.
60. Define stepAIC() function.
It is define under the MASS package which performs stepwise model selection under exact AIC.
61. Define leaps().
It is used to perform the all-subsets regression and it is defined under the leaps package.
62.Define relaimpo package.
It is used to measure the relative importance of each of the predictor in the model.
63.Why car package is used?
It provide a variety of regression including scatter plots, variable plots and it also enhanced diagnostic.
64. Define robust package.
It provides a library of robust methods including regression.
65. What is robustbase?
It is a package which provides basic robust statistics including model selection methods.
66. Define plotmeans().
It is define under gplots package which includes confidence intervals and it produces mean plot for single factors.
67.What is the full form of MANOVA?
MANOVA stands for multivariate analysis of variance.
68. What is the use of MANOVA?
By using MANOVA we can test more than one dependent variable simultaneously.
69. Define mshapiro.test( ).
It is a function which defines in mvnormtest package. It produces the Shapiro-wilk test for multivariate normality.
70. Define barlett.test().
Barlett.test() is used to provide a parametric k-sample test of the equality of variances.
71.What is fligner.test()?
It is a function which provides a non-parametric k sample test of the equality of variances.
It is define in HH package which provides a graphic test of homogeneity of variance based on brown forsyth.
73.Which variables are represented by lower case letters?
Numerical variables are represented by lower case letters.
74. Which variables are represented by upper case letters?
Categorical factors are represented by upper case letters.
75.What is logistic regression?
Logistic regression is used to predict the binary outcome from the given set of continuous predictor variables.
76.Define Poison regression.
It is used to predict the outcome variable which represents counts from the given set of continuous predictor variable.
77.Define Survival analysis.
It includes number of techniques which is used for modeling the time to an event.
78. What is the use survfit() function?
It estimates a survival distribution one or more groups.
79. Define survdiff().
It determines the differences in survival distribution between two or more groups.
80.What is coxph()?
It is a function which is used to model the hazard function on the set of predictor variable.
81. In which package survival analysis is defined?
Survival analysis is defined under the survival package.
82.What is the use of MASS package?
MASS functions include those functions which performs linear and quadratic discriminant function analysis.
83. Define qda().
qda() prints a quadratic discriminant function.
lda() is used to print the discriminant functions which is based on centered variable.
85. What is the use of forecast package?
It provides the functions which are used for automatic selection of ARIMA and exponential models.
It is used to handle the seasonal as well as non-seasonal ARIMA models.
87.What is principal() function?
It is define in psych package which is used to rotate and extract the principal componants.
88.What is FactoMineR?
It is a package which includes quantitative and qualitative variables. It also includes supplementary variables and observations.
89.What is the full form of CFA?
CFA stands for Confirmatory Factor Analysis.
90.What is the use of boot.sem() function?
It is used to bootstrap the structural equation model.
91.What is the full form of SEM?
SEM stands for Structural Equation Modeling.
92. Which function performs classical multidimensional scaling?
cmdscale() function is used to perform classical multidimensional scaling.
This function is defined under the MASS package which performs nonmetric multidimensional scaling.
94.Which function perform individual difference scaling?
It is done by indscal() function.
95. What is pvclust() function ?
It comes under the pvclust package which provides p-values for hierarchical clustering .
96.Define cluster.stats() ?
It is define in fpc package which provide a method for comparing the similarity of two clusters solution using different validation criteria.
97.What we use party package?
It is used to provide a non-parametric regression for ordinal, nominal, censored and multivariate responses.
98. Which package provide the bootstrapping?
boot package is used which provide bootstrapping.
99.Define matlab package.
Matlab package includes those wrapper functions and variable which are used to replicate matlab function calls.
100.What is the of use Matrix package?
Matrix package includes those function which support sparse and dense matrices like Lapack, BLAS etc.