R Programming Interview Questions and Answers Set 5

41. What is the difference between rnorm and runif functions ?

rnorm function generates “n” normal random numbers based on the mean and standard deviation arguments passed to the function.

Syntax of rnorm function

rnorm(n, mean = , sd = )

runif function generates “n” unform random numbers in the interval of minimum and maximum values passed to the function.

Syntax of runif function

runif(n, min = , max = )

42. What will be the output on executing the following R programming code

mat<-matrix(rep(c(TRUE,FALSE),8),nrow=4)

sum(mat)

8

43. What is power analysis ?

Power analysis is the process used to determine the effect of a given sample size and is generally used for experimental design. Pwr package in R is used for power analysis.

44. What are connections In R?

Functions to Manipulate Connections (Files, URLs, …). Functions to create, open and close connections.

For example: “generalized files”, such as compressed files, URLs, pipes, etc.

Keywords: file, connection

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



46. What is the byte in R?

A byte is a data equal to either seven or eight bits depending if it needs error correction (parity)

47. What is the usage of the lattice package in R?

Lattice package helps enhance base R graphics by providing better defaults and helps easily display multi-variate relationships.

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

49. Compare R with other technologies.

Data handling Capabilities – Good data handling capabilities and options for parallel computation.

Availability / Cost – R is an open source and we can use it anywhere.

Advancement in Tool –  if you are working on the latest technologies, R gets latest features.

Ease of Learning – R has a learning curve. R is a low-level programming language. As a result, simple procedures can take long codes.

Job Scenario – It is a better option for start-ups and companies looking for cost efficiency.

Graphical capabilities – R is having the most advanced graphical capabilities. Hence, it provides us with advanced graphical capabilities.

Customer Service support and community – R is the biggest online growing community.

50. What are R topical programming and statistical relevance?

Statistical

  • R is free, open source software.
  • R is available from free software Foundation.

Programming

  • Data inputs such as data type, importing data, keyboard typing.
  • Data Management such as data variables, operators.