Data Analysis with R
2.0 Credits
Objective Assessment Review (Qns &
Ans)
2025
©2025
, Question 1:
An analyst working with very large datasets in R seeks to speed up data
manipulation and aggregation. Which package is renowned for its
enhanced performance and efficient in‑memory processing compared to
traditional data frames?
- A. dplyr
- B. data.table
- C. plyr
- D. reshape2
Correct ANS: B. data.table
Rationale:
The data.table package is optimized in C and is well known for its
speed and memory efficiency in handling large datasets. Its concise
syntax for chaining operations makes it highly suitable for big data
analytics.
---
Question 2:
When profiling R code to identify performance bottlenecks, which
built‑in function is primarily used to collect profiling data?
- A. system.time()
- B. Rprof()
- C. microbenchmark()
- D. proc.time()
Correct ANS: B. Rprof()
Rationale:
Rprof() is R’s built‑in function for profiling, which records a summary
of the function calls and time spent in each, enabling developers to
pinpoint inefficient code and optimize performance.
---
©2025
, Question 3:
In order to avoid redundant computations in R, especially in the context
of expensive function calls, which package provides a straightforward
memoization utility?
- A. lazyeval
- B. memoise
- C. promises
- D. purrr
Correct ANS: B. memoise
Rationale:
The memoise package enables memoization in R by caching the results
of function calls. This prevents multiple evaluations of the same inputs,
greatly enhancing performance when the function is computationally
intensive.
---
Question 4:
For transforming a static ggplot2 visualization into an interactive one for
exploratory data analysis, which function from the plotly package is most
commonly used?
- A. gginteractive()
- B. plotly()
- C. ggplotly()
- D. interactive_ggplot()
Correct ANS: C. ggplotly()
Rationale:
The ggplotly() function takes a ggplot2 object and converts it into an
interactive plotly graphic. This is useful for data exploration as it allows
zooming, hovering, and dynamic interactions.
---
©2025