R Interview Questions And Answers
1. 
Define r language?R is a programming language for data analysis and graphics as it provides facility for reading, manipulating and computing data, conducting statistical analysis and displaying the results. It is a command line driven program means the commands evaluate and execute in the console. 
2. 
Who created R programming language and when?R programming language created in the early 1990s by Ross Ihaka and Robert Gentleman of the Statistics Department of the University of Auckland and it is currently maintained by the R coredevelopment team. 
3. 
What are the some popular GUIs for R.There are some free GUIs available for R. Among them the most popular are 

4. 
How can we remove object from r?The functions remove() and rm() are used to remove objects from the working directory. 
5. 
How to write comments in R?R supports single line comment same style as in shell using # in the beginning of the statement.

6. 
What are the different types of data types in R?These are the most frequently used data types

7. 
What are nrow and ncol in Matrix?The number of rows and columns of the matrix is assigned in nrow and ncol. 
8. 
What is factors?Factors are a special variable type for storing categorical variables. A factor can contain both integers and strings and it is generally used in statistical modeling. The factor() function is used to create a factor. 
9. 
What is the difference between vector and list?A vector represents a set of elements of the same mode, which can be integer, floating number, character, complex and so on while a list may contain different objects. A vector have all elements of the same type, but a list may contain elements of different types. 
10. 
What is Matrix?A matrix (plural: matrices) is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns. It has two dimensional structure. All columns in a matrix are the same type and of the same length. In R, a matrix is created by using matrix() function. 
11. 
How to declare a data frame in r?A data frame is created by data.frame() function.

12. 
What is Colon Operator?The colon operator generates a regular sequence, which is equivalent to interaction(a,b) but the levels are ordered and labelled differently. 
13. 
What is belongs to operator?The %in% operator identifies whether an element belongs to a vector or not. 
14. 
What is the operator of vector multiplication with its transpose?The %*% operator performs multiplication of a vector with its transpose. 
15. 
How do you create a vector of sequence 10 to 30?The colon operator generates a regular sequence of numbers. It requires starting and end value of the sequence.

16. 
How do you create a vector of sequence from 10 to 30 and each next element increment by 0.3?R provides seq() function to generate a vector of sequence of numbers. The below code generates a vector of sequence beginning from 1 to 5 and each next element increment by 0.3.

17. 
How do you access and change the dimnames values of matrix?R provide colnames() and rownames() functions to access and change the dimnames values. The below code returns the columns and rows dimnames of matrix M.

18. 
Which function is used to know the structure of a data frame?R provides str() function to get the structure of the data frame. 
19. 
How can we add new rows in the existing data frame?R provides rbind() function to add new rows in the existing data frame. For this, we have to create a second data frame and merge to the existing one. 
20. 
Define factors in R?Factor is a special variable type for storing categorical variables as levels, it is generally used in statistical modeling. It may contain both numeric and character values, but the factor levels will always be character values. 
21. 
What is repeat loop?Repeat loop is the easiest loop in R. It is similar to the dowhile loop of other languages. In this, the conditional check is written at the end of the loop iteration, so the statement is executed first before the condition is tested. 
22. 
What is syntax of for loop in r?Syntax of the for loop in R

23. 
What is the role of paste() function in string?The paste() function concatenates several strings and returns the result in one long string. 
24. 
How do you get length of a string in r?The nchar() function finds the length of a string. 
25. 
How do you get the list of all installed packages in your system?The library() function displays all the installed packages in your system. 
26. 
What is the role of libPaths()?R provides libPaths() function to know the library paths in your system.

27. 
What is the syntax to uninstall a package?The followin syntac uninstall a package.
Here, pkg is the name of the package to remove and lib is the library directory to remove. 
28. 
Give a name of package for interacting with JSON?R provides 'jsonlite' package for interacting with JSON. To install this package, use the install.package() command with the package name. 
29. 
Give a name of package to connect with MySQL?R provides a RMySQL package to connect to MySQL.

30. 
Which function is used to list all the tables under the database?The dbListTables() function is used to list all tables under the database.

31. 
Write the syntax to create connection with mongodb?

32. 
What is the scatter plot?The scatter plot is a type of plot, especially to show the relationship between two variables. One of the two variables is scaled horizontally and the other is scaled vertically, and the graph is plotted on a Cartesian plane based on these variable positions. 
33. 
Define histogram with syntax?A histogram is an accurate representation of the distribution of numerical data. R provides hist() function to generate a histogram. This function takes a vector as input. It is similar to the bar chart except a bar graph relates two variable, but a histogram relates only one variable.

34. 
What is r box plots?Boxplot is a visual representation of data that shows the minimum, first quartile, median, third quartile and maximum in the graph. The median is a line that divides the box into two parts. 
35. 
What are the different sorting algorithms present in R?The different sorting algorithms present in R are 

36. 
What is the use of abline() function?The abline() function is a low level plotting function which adds one or more straight lines (vertical, horizontal or regression lines) to the current plot. 
37. 
What is the role of t.test()?The t.test( ) function is one of the most common tests in statistics and used to determine the means of two groups are equal to each other or not. There are different types of t.test(), like one sample ttest(), paired samples ttest(), independent samples ttest(). 
38. 
What is the Hovplot() function?The Hovplot() function is defined in HH package to conduct graphics test for homogeneity. 
39. 
What is the default memory limit in R?The default memory limit in R is 3GB for 32bit system memory and 8TB for 64bit system memory. 
40. 
How do you increase the default memory limit in R?We can increase the default memory limit in R with the help of memory.limit(size) function, where the size is in MB. 
41. 
How do you represent the missing values in R?In R, the missing values are represented by NA (capital letters). 
42. 
What is the difference between lapply() and sapply() functions?The lapply() function takes list, vector, data frame as input and returns only list as output, ane the sapply() function takes list, vector or data frame as input and returns only vector as output. 
43. 
What are R packages?R provides a good collection of functions for solving many developmental problems. These collections are called packages. Some packages are installed by default with R installation. Most of the packages are available on R official website http://CRAN.Rproject.org/, that we can easily install later as per our requirement. 
44. 
What is GGobi?GGobi is a powerful tool for data exploration, and the integration with R. 
45. 
What is the use of rapply() function?The rapply() function is the recursive apply, which apply a function to all elements of a list recursively. 
◀ Previous
Express js Interview Questions
Express js Interview Questions
Next ▶
MongoDB Interview Questions
MongoDB Interview Questions