R Language interview questions

R Language quiz questions

  • 1.

    Explain about the significance of transpose in R language

    Answer:

    Transpose t () is the easiest method for reshaping the data before analysis.

    View
  • 2.

    What is the process to create a table in R language without using external files?

    Answer:

    MyTable= data.frame ()

     edit (MyTable)

    The above code will open an Excel Spreadsheet for entering data into MyTable.

    Learn Data Science in R Programming to land a top gig as an Enterprise Data Scientist!

    View
  • 3.

    What is the value of f (2) for the following R code?

    Answer:

    
    b <- 4
    f <- function (a)
    {
    b <- 3
    b^3 + g (a)
    }
    g <- function (a)
    {
    a*b
    }

    The answer to the above code snippet is 35. The value of “a” passed to the function is 2 and the value for “b” defined in the function f (a) is 3. So the output would be 3^3 + g (2). The function g is defined in the global environment and it takes the value of b as 4(due to lexical scoping in R) not 3 returning a value 2*4= 8 to the function f. The result will be 3^3+8= 35.

    View
  • 4.

    How many data structures does R language have?

    Answer:

    R language has Homogeneous and Heterogeneous data structures. Homogeneous data structures have same type of objects – Vector, Matrix ad Array. Heterogeneous data structures have different type of objects – Data frames and lists.

    View
  • 5.

    What is the best way to communicate the results of data analysis using R language?

    Answer:

    The best possible way to do this is combine the data, code and analysis results in a single document using knitr for reproducible research. This helps others to verify the findings, add to them and engage in discussions. Reproducible research makes it easy to redo the experiments by inserting new data and applying it to a different problem.

    View
  • 6.

    Which function in R language is used to find out whether the means of 2 groups are equal to each other or not?

    Answer:

    t.tests ()

    View
  • 7.

    R language has several packages for solving a particular problem. How do you make a decision on which one is the best to use?

    Answer:

    CRAN package ecosystem has more than 6000 packages. The best way for beginners to answer this question is to mention that they would look for a package that follows good software development principles. The next thing would be to look for user reviews and find out if other data scientists or analysts have been able to solve a similar problem.

    View
  • 8.

    How missing values and impossible values are represented in R language?

    Answer:

    NaN (Not a Number) is used to represent impossible values whereas NA (Not Available) is used to represent missing values. The best way to answer this question would be to mention that deleting missing values is not a good idea because the probable cause for missing value could be some problem with data collection or programming or the query. It is good to find the root cause of the missing values and then take necessary steps handle them.

    View
  • 9.

    Two vectors X and Y are defined as follows – X <- c(3, 2, 4) and Y <- c(1, 2). What will be output of vector Z that is defined as Z <- X*Y.

    Answer:

    In R language when the vectors have different lengths, the multiplication begins with the smaller vector and continues till all the elements in the larger vector have been multiplied.

    The output of the above code will be –

    Z <- (3, 4, 4)

    View
  • 10.

    Explain about data import in R language

    Answer:

    R Commander is used to import data in R language. To start the R commander GUI, the user must type in the command Rcmdr into the console. There are 3 different ways in which data can be imported in R language-

    • Users can select the data set in the dialog box or enter the name of the data set (if they know).

    • Data can also be entered directly using the editor of R Commander via Data->New Data Set. However, this works well when the data set is not too large.

    • Data can also be imported from a URL or from a plain text file (ASCII), from any other statistical package or from the clipboard.

    View

© 2017 QuizBucket.org