Read the questions. At the bottom, you will find a link to the answers.

**The Questions**

**First Set**

- Explain what is R?
- List out some of the function that R provides?
- Explain how you can start the R commander GUI?
- In R how you can import Data?
- Mention what does not ‘R’ language do?
- Explain how R commands are written?
- How can you save your data in R?
- Mention how you can produce co-relations and covariances?
- Explain what is t-tests in R?
- Explain what is With () and By () function in R is used for?
- What are the data structures in R that is used to perform statistical analyses and create graphs?
- Explain general format of Matrices in R?
- In R how missing values are represented ?
- Explain what is transpose?
- Explain how data is aggregated in R?
- What is the function used for adding datasets in R?
- What is the use of subset() function and sample() function in R ?
- Explain how you can create a table in R without external file?

You can find the answers here.

**Second Set**

- Data structure -- How many data structures R has? How do you build a binary search tree in R?
- Sorting -- How many sorting algorithms are available? Show me an example in R.
- Low level -- How do you build a R function powered by C?
- String -- How do you implement string operation in R?
- Vectorization -- If you want to do Monte Carlo simulation by R, how do you improve the efficiency?
- Function -- How do you take function as argument of another function? What is the apply() function family?
- Threading -- How do you do multi-threading in R?
- Memory limit and database -- What is the memory limit of R? How do you avoid it? How do you use SQL in R?
- Testing -- How do you do testing and debugging in R?
- Software development -- How do you develop a package? How do you do version control?

You can find the answers here.

**Third Set **

1. If I have a data.frame `df <- data.frame(a = c(1, 2, 3), b = c(4, 5, 6), c(7, 8, 9))`

...

- How do I select the
`c(4, 5, 6)`

? - How do I select the
`1`

? - How do I select the
`5`

? - What is
`df[, 3]`

? - What is
`df[1,]`

? - What is
`df[2, 2]`

?

2. What is the difference between a matrix and a dataframe?

3. If I concatenate a number and a character together, what will the class of the resulting vector be?

4. What if I concatenate a number and a logical?

5. What if I concatenate a number and `NA`

?

6. What is the difference between `sapply`

and `lapply`

? When should you use one versus the other? Bonus: When should you use `vapply`

?

7. What is the difference between `seq(4)`

and `seq_along(4)`

?

8. What is `f(3)`

where:

`y <- 5 f <- function(x) { y <- 2; y^2 + g(x) } g <- function(x) { x + y }`

Why?

9. I want to know all the values in `c(1, 4, 5, 9, 10)`

that are not in `c(1, 5, 10, 11, 13)`

. How do I do that with one built-in function in R? How could I do it if that function didn't exist?

10. Can you write me a function in R that replaces all missing values of a vector with the mean of that vector?

11. How do you test R code? Can you write a test for the function you wrote in #6?

12. Say I have...

`fn(a, b, c, d, e) a + b * c - d / e`

How do I call `fn`

on the vector `c(1, 2, 3, 4, 5)`

so that I get the same result as `fn(1, 2, 3, 4, 5)`

? (No need to tell me the result, just how to do it.)

13. dplyr <- "ggplot2" library(dplyr)

Why does the dplyr package get loaded and not ggplot2?

14. mystery_method <- function(x) { function(z) Reduce(function(y, w) w(y), x, z) } fn <- mystery_method(c(function(x) x + 1, function(x) x * x)) fn(3)

What is the value of `fn(3)`

? Can you explain what is happening at each step?

You can find the answers here.

Other R questions are posted here.

**Related articles**

- 91 data science questions - by Vincent Granville

© 2016 Data Science Central Powered by

Badges | Report an Issue | Privacy Policy | Terms of Service

## You need to be a member of Data Science Central to add comments!

Join Data Science Central