Программирование на R: 42 вопроса для собеседования

Предлагаем рассмотреть список вопрос по программированию на R, которые могут задать в рамках собеседования на работу в сфере data science. Вопросы разбиты на 3 части, для каждый из частей есть отдельный пост с ответами. На несложном английском.

Часть 1

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

You can find the answers here.

Часть 2

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

You can find the answers here.

Часть 3

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.

Источник

Статья по теме: 4 хитрых вопроса по R

Data Scientist # 1

Машинное обучение, большие данные, наука о данных, анализ данных, цифровой маркетинг, искусственный интеллект, нейронные сети, глубокое обучение, data science, data scientist, machine learning, artificial intelligence, big data, deep learning

Данные — новый актив!

Эффективно управлять можно только тем, что можно измерить.
Copyright © 2016-2021 Data Scientist. Все права защищены.