R Programming Interview Questions and Answers Set 2

11. What is the function definition?

An R function is been created using the keyword function. The basic syntax of an R function definition is as follows

function_name <- function(arg_1, arg_2, …) {

Function body

}

12. What is control structure in R?

R has the standard control structures we would expect. expr can be multiple statements by enclosing them in braces { }. It is more efficient to use built-in functions rather than control structures whenever possible. These allow us to control the flow of execution of a script typically inside of a function. Control structures define the flow of the program. The decision is been based on the evaluation of a variable.

13. What is the function used for adding datasets in R?

rbind function can be used to join two data frames (datasets). The two data frames must have the same variables, but they do not have to be in the same order.

14. What are the data structures in R that are used to perform statistical analyses and create graphs?

R has data structures like

  • Vectors
  • Matrices
  • Arrays
  • Data frames

15. How to read data from the keyboard?

To read the data from keyboard we use three different functions:

  • scan()
  • readline()
  • print()



16. What is TCP/IP in R?

TCP/IP is a set of protocols. It is a primary tech of the internet. When we browse the web, send email, chat online, online gaming, TCP/IP is working underneath.

17. What is debugging in R?

A grammatically correct program may give us incorrect results due to logic errors. In case such errors (i.e. bugs) occur, we need to find out why and where they occur so that you can fix them. The procedure to identify and fix bugs is called “debugging”.

18. What are the tools for debugging in R?

There are five tools present for debugging in R respectively:

  • traceback()
  • debug()
  • browser()
  • trace()
  • recover()

19. How many methods are there to save graphs?

There are three methods to save graphs respectively

  • A General method
  • another approach
  • Local Sessions with Windows or OS X

20. What is JIT in R?

There are two R packages available that offers Just-in-time compilation to R users: the {jit} package and the {compiler} package.