R Programming Language Multiple Choice Questions on “Exploratory Data Analysis”.
1. Which of the following is a principle of analytic graphics?
a) Don’t plot more than two variables at at time
b) Make judicious use of color in your scatterplots
c) Show box plots (univariate summaries)
d) Show causality, mechanism, explanation
Answer: d
Clarification: Only do what your tools allow you to do.
2. What is the role of exploratory graphs in data analysis?
a) They are made for formal presentations
b) They are typically made very quickly
c) Axes, legends, and other details are clean and exactly detailed
d) They are used in place of formal modeling
Answer: b
Clarification: EDA is used to summarize main characteristic of data.
3. Which of the following is true about the base plotting system?
a) Margins and spacings are adjusted automatically depending on the type of plot and the data
b) Plots are typically created with a single function call
c) Plots are created and annotated with separate functions
d) The system is most useful for conditioning plots
Answer: c
Clarification: Functions like ‘plot’ or ‘hist’ typically create the plot on the graphics device and functions like ‘lines’, ‘text’, or ‘points’ will annotate or add data
to the plot.
4. Which of the following is an example of a valid graphics device in R?
a) A socket connection
b) A Microsoft Word document
c) A PDF file
d) A file folder
Answer: c
Clarification: PNG file is also valid graphics device.
5. Which of the following is an example of a vector graphics device in R?
a) JPEG
b) PNG
c) GIF
d) SVG
Answer: d
Clarification: SVG stands for scalable vector graphics.
6. Bitmapped file formats can be most useful for ____________
a) Plots that may need to be resized
b) Plots that require animation or interactivity
c) Plots that are not scaled to a specific resolution
d) Scatterplots with many many points
Answer: d
Clarification: Scatterplots would be used frequently for particular dimension.
7. Which of the following functions is typically used to add elements to a plot in the base graphics system?
a) lines()
b) hist()
c) plot()
d) boxplot()
Answer: d
Clarification: text() also can be used to add elements to a plot. boxplot() used to add elements to a plot in the base graphics system.
8. Which function opens the screen graphics device for the Mac?
a) bitmap()
b) quartz()
c) pdf()
d) png()
Answer: b
Clarification: quartz starts a graphics device driver for the Mac.
9. What does the ‘pch’ option to par() control?
a) the size of the plotting symbol in a scatterplot
b) the line width in the base graphics system
c) the orientation of the axis labels on the plot
d) the plotting symbol/character in the base graphics system
Answer: d
Clarification: R makes it easy to combine multiple plots into one overall graph, using either the par ( ) or layout( ) function.
10. If I want to save a plot to a PDF file, which of the following is a correct way of doing that?
a) Construct the plot on the screen device and then copy it to a PDF file with dev.copy2pdf()
b) Construct the plot on the PNG device with png(), then copy it to a PDF with dev.copy2pdf()
c) Open the PostScript device with postscript(), construct the plot, then close the device with dev.off()
d) Open the screen device with quartz(), construct the plot, and then close the device with dev.off()
Answer: a
Clarification: With the par( ) function, you can include the option mfrow=c(nrows, ncols) to create a matrix of nrows x ncols plots that are filled in by row.