R Programming Questions and Answers – ggplot2 – 2

This set of R Programming Aptitude Test focuses on “ggplot2 – 2”.

1. _________ generate aesthetic mappings that describe how variables in the data.
a) aes_all
b) aes_auto
c) aes
d) aes_string
View Answer

Answer: c
Explanation: aes generate aesthetic mappings that describe how variables in the data. aes_auto is used for automatic aesthetic mapping.

2. Point out the correct statement?
a) update_element update contents of a theme
b) Use theme_update_element to modify a small number of elements of the current theme or use theme_set to completely override it
c) theme_bw is theme with grey background and white gridlines
d) is.rel reports whether x is a theme object
View Answer

Answer: a
Explanation: update_element function is deprecated. Use %+replace% or +.gg instead.

3. ______ generate aesthetic mappings from a string.
a) aes_all
b) aes_auto
c) aes_string
d) aes_position
View Answer

Answer: c
Explanation: Aesthetic mappings describe how variables in the data are mapped to visual properties (aesthetics) of geoms.

advertisement
advertisement

4. Which of the following is a differentiation related aesthetic?
a) aes_position
b) aes_group_order
c) aes_linetype_size_shape
d) ggorder
View Answer

Answer: c
Explanation: aes_position is position related aesthetics.

5. Point out the wrong statement?
a) is.rel reports whether x is a theme object
b) is.theme reports whether x is a theme object
c) opts build a theme (or partial theme) from theme elements
d) theme_bw is theme with grey background and white gridlines
View Answer

Answer: a
Explanation: is.rel reports whether x is a real object.

Note: Join free Sanfoundry classes at Telegram or Youtube

6. ________ modify a ggplot or theme object by adding on new components.
a) +.gg
b) -.gg
c) /.gg
d) .gg
View Answer

Answer: a
Explanation: This operator allows you to add objects to a ggplot or theme object.

7. __________ create a complete ggplot appropriate to a particular data type.
a) autoplot
b) is.ggplot
c) printplot
d) qplot_ggplot
View Answer

Answer: a
Explanation: autoplot uses ggplot2 to draw a particular plot for an object of a particular class in a single command.

advertisement

8. Which of the following creates a new ggplot plot from a data frame?
a) qplot_ggplot
b) ggplot.data.frame
c) ggfluctuation
d) ggmissplot
View Answer

Answer: b
Explanation: Default list of aesthetic mappings are displayed.

9. Which of the following draws plot on current graphics device?
a) ggmissplot
b) printplot
c) print.ggplot
d) ggfluctuation
View Answer

Answer: c
Explanation: print.ggplot is also known as plot.ggplot.
advertisement

10. ________ is used for relative sizing of theme elements.
a) rel
b) size
c) relative
d) timrinterval
View Answer

Answer: a
Explanation: The syntax for rel is rel(X) where x is a number representing the relative size.

Sanfoundry Global Education & Learning Series – R Programming Language.

Here’s the list of Best Books in R Programming Language.

To practice all areas of R Programming for aptitude tests, Here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.