# 40+ [REAL-TIME] Data Visualization in R Interview Questions and Answers

Last updated on 18th Nov 2021, Blog, Interview Questions

Browse our top Data Visualization in R interview questions and answers and start preparing for your Data Visualization in R interview. It will help you fast-track your career and land you into the best jobs as Data Visualization Specialists, Data Visualization Engineer, Data Visualization Developer, etc. Set your bar higher with our interview questions for Data Visualization in R that will give you the much-needed edge over your peers. Prepare well and crack your interview with ease and confidence!

**1.Compare R & Python. **

**Ans:**

Model Building is similar to Python. | Model Building is similar to R. |

Model Interpretability is good. | Model Interpretability is not good. |

Production is not better than Python. | Production is good. |

R has good community support over Python. | Community Support is not better than R. |

Data Science Libraries are same as Python. | Data Science Libraries are same as R. |

R has good data visualizations libraries and tools. | Data visualization is not better than R. |

R has a steep learning curve. | Learning Curve in Python is easier than learning R. |

**2.Explain the data import in R language. **

**Ans:**

- 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.

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:-

**3.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.

**4.What is R? **

**Ans:**

R is a programming language which is used for developing statistical software and data analysis. It is being increasingly deployed for machine learning applications as well.

**5.How R commands are written? **

**Ans:**

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

**6.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.

**7.What are the disadvantages of R Programming? **

**Ans:**

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

The disadvantages are:-

**8.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)

**9.In R programming, how missing values are represented? **

**Ans:**

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

**10.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.

**11.Explain what is transpose. **

**Ans:**

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

**12.What are the advantages of R? **

**Ans:**

- 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.

The advantages are:-

**13.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:**

**14.How you can produce co-relations and covariances? **

**Ans:**

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

**15.What is difference between matrix and dataframes? **

**Ans:**

Dataframe can contain different type of data but matrix can contain only similar type of data. Here are the different types of data structures in R:

**16.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.

**17.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)).

**18.Explain how you can start the R commander GUI. **

**Ans:**

rcmdr command is used to start the R commander GUI.

**19.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.

**20.How many data structures R has? **

**Ans:**

**21.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.

**22.How many sorting algorithms are available? **

**Ans:**

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

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

**23.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

**24.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. One of the strengths of R is the user-written function in R language.

**25.What is the workspace in R? **

**Ans:**

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

**26.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’)

**27.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)

**28.What is the power analysis? **

**Ans:**

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

**29.Which package is used for power analysis in R? **

**Ans:**

Pwr package is used for power analysis in R.

**30.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.

**31.Which packages are used for exporting of data? **

**Ans:**

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

**32.How impossible values are represented in R? **

**Ans:**

In R NaN is used to represent impossible values.

**33.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”)

**34.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”)

**35.What is the use of coin package in R? **

**Ans:**

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

**36.Which function is used for sorting in R? **

**Ans:**

order() function is used to perform the sorting.

**37.What is the use of tapply? **

**Ans:**

IOS-6.1.3

**38.What happens when the application object does not handle an event? **

**Ans:**

The event will be dispatched to your delegate for processing.

**39.Explain app specific objects which store the app contents. **

**Ans:**

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

**40.Explain the purpose of using UIWindow object? **

**Ans:**

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

**41.Tell me the super class of all view controller objects. **

**Ans:**

UIView Controller class.

**42.How to create axes in the graph? **

**Ans:**

Using axes() function custom axes are created.

**43.What is the use of abline() function? **

**Ans:**

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

**Syntax:** abline(h=yvalues, v=xvalues)

**44.Why vcd package is used? **

**Ans:**

vcd package provides different methods for visualizing multivariate categorical data.

**45.What is GGobi? **

**Ans:**

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

**46.What is iPlots? **

**Ans:**

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

**47.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.

**48.What is fitdistr() function? **

**Ans:**

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

**49.Which data structures are used to perform statistical analysis and create graphs. **

**Ans:**

Data structures are vectors, arrays, data frames and matrices.

**50.What is the use of sink() function? **

**Ans:**

It defines the direction of output.

**51.Why library() function is used? **

**Ans:**

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

**52.Why search() function is used? **

**Ans:**

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

**53.On which type of data binary operators are worked? **

**Ans:**

Binary operators are worked on matrices, vectors and scalars.

**54.Which function is used to create frequency table? **

**Ans:**

Frequency table is created by table() function.

**55.Define loglm() function. **

**Ans:**

Loglm() function is used to create log-linear models.

**56.What is the use of corrgram() function? **

**Ans:**

corrgram() function is used to plot correlograms.

**57.How to create scatterplot matrices? **

**Ans:**

Pair() or splom() function is used for create scatterplot matrices.

**58.What is npmc? **

**Ans:**

It is a package which gives nonparametric multiple comparisons.

**59.What is the use of diagnostic plots? **

**Ans:**

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

**60.Define anova() function. **

**Ans:**

anova() is used to compare the nested models.

**61.What is cv.lm() function? **

**Ans:**

It is defined under the DAAG package which is used for k-fold validation.

**62.Define stepAIC() function. **

**Ans:**

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

**63.Define leaps(). **

**Ans:**

It is used to perform the all-subsets regression and it is defined under the leaps package.

**64.Define relaimpo package. **

**Ans:**

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

**65.Why car package is used? **

**Ans:**

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

**66.Define robust package. **

**Ans:**

It provides a library of robust methods including regression.

**67.What is robustbase? **

**Ans:**

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

**68.Define plotmeans(). **

**Ans:**

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

**69.What is the full form of MANOVA? **

**Ans:**

MANOVA stands for multivariate analysis of variance.

**70.What is the use of MANOVA? **

**Ans:**

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

**71.Define mshapiro.test( ). **

**Ans:**

It is a function which defines in mvnormtest package. It produces the Shapiro-wilk test for multivariate normality.

**72.Define barlett.test(). **

**Ans:**

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

**73.What is fligner.test()? **

**Ans:**

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

**74.Define hovplot(). **

**Ans:**

It is define in HH package which provides a graphic test of homogeneity of variance based on brown forsyth.

**75.Which variables are represented by lower case letters? **

**Ans:**

Numerical variables are represented by lower case letters.

**76.Which variables are represented by upper case letters? **

**Ans:**

Categorical factors are represented by upper case letters.Learn more about R in this insightful article on R programming.

**77.What is logistic regression? **

**Ans:**

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

**78.Define Poison regression. **

**Ans:**

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

**79.Define Survival analysis. **

**Ans:**

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

**80.What is the use survfit() function? **

**Ans:**

It estimates a survival distribution one or more groups.

**81.Define survdiff(). **

**Ans:**

It determines the differences in survival distribution between two or more groups.

**82.What is coxph()? **

**Ans:**

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

**83.In which package survival analysis is defined? **

**Ans:**

Survival analysis is defined under the survival package.

**84.What is the use of MASS package? **

**Ans:**

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

**85.Define qda(). **

**Ans:**

qda() prints a quadratic discriminant function.

**86.Define lda(). **

**Ans:**

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

**87.What is the use of forecast package? **

**Ans:**

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

**88.Define auto.arima(). **

**Ans:**

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

**89.What is principal() function? **

**Ans:**

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

**90.What is FactoMineR? **

**Ans:**

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

**91.What is the full form of CFA? **

**Ans:**

CFA stands for Confirmatory Factor Analysis.

**92.What is the use of boot.sem() function? **

**Ans:**

It is used to bootstrap the structural equation model.

**93.What is the full form of SEM? **

**Ans:**

SEM stands for Structural Equation Modeling.

**94.Which function performs classical multidimensional scaling? **

**Ans:**

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

**95.Define isoMDS(). **

**Ans:**

This function is defined under the MASS package which performs nonmetric multidimensional scaling.

**96.Which function perform individual difference scaling? **

**Ans:**

It is done by indscal() function.

**97.What is pvclust() function ? **

**Ans:**

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

**98.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.

**99.What we use party package? **

**Ans:**

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

**100.Which package provide the bootstrapping? **

**Ans:**

Boot package is used which provide bootstrapping.