Home » Data Visualization with R Cognitive Class Exam Answers

Data Visualization with R Cognitive Class Exam Answers

by IndiaSuccessStories
0 comment

Introduction to Data Visualization with R

Data visualization is the graphical representation of data and information. It enables us to discover patterns, trends, and insights that might be hidden in raw data. R provides powerful tools and libraries for creating a wide variety of visualizations.

Why Use R for Data Visualization?

R is a popular programming language for statistical computing and graphics. It offers several advantages for data visualization:

  1. Rich Ecosystem: R has a vast collection of packages specifically designed for data visualization, such as ggplot2, plotly, ggvis, leaflet, and more.
  2. Flexibility: R provides extensive capabilities to customize and control the visual appearance of plots, allowing you to create complex and publication-quality graphics.
  3. Integration: R seamlessly integrates data manipulation, statistical analysis, and visualization, making it ideal for end-to-end data analysis workflows.

Getting Started with R for Data Visualization

To start visualizing data in R, follow these steps:

  1. Install R and RStudio: RStudio is a popular integrated development environment (IDE) for R that makes it easier to work with R projects and visualize data.
  2. Load Data: Import your data into R using functions like read.csv() for CSV files, read.table() for tabular data, or directly loading data from R datasets.
  3. Choose a Visualization Package: Depending on the type of visualization you want to create, choose an appropriate package. For example:
    • ggplot2: For creating elegant and customizable static plots.
    • plotly: For interactive and web-based visualizations.
    • ggvis: For interactive grammar of graphics.
    • leaflet: For interactive maps.
  4. Create Plots: Use functions provided by your chosen package to create visualizations. For ggplot2, start with ggplot() function and layer on aesthetics and geometries.
  5. Customize: Adjust the aesthetics (like colors, sizes, labels) and add layers (like points, lines, bars) to tailor the plot to your needs.
  6. Save and Share: Save your plots in various formats (PNG, PDF, etc.) and share them in reports, presentations, or web applications.

Data visualization in R is a dynamic and rewarding skill that opens doors to exploring and communicating insights from data effectively.

banner

Data Visualization with R Cognitive Class Certification Answers

Question 1: Choose the correct code from the following options to install the ggplot2 library in R.

  • install.packages(ggplot2)
  • install.package(“ggplot2”)
  • install.packages(“ggplot2”)
  • install.package(ggplot2)

Question 2: Select the correct code that provides numerical values to different segments of the pie chart?

  • coord_polar(theta=’y’)
  • coord_polar(‘y’)
  • theta = coord_polar(‘y’)
  • coord_polar()

Question 3: Select the correct code from the following options to remove the color of the bars in the histogram?

  • xlab = 0
  • alpha = I(0)
  • binwidth = 0
  • geom = 0

Question 1: Select the correct methods used to create a scatterplot in R?

  • scatterplot3d()
  • scatterplot()
  • qplot()
  • plot()
  • All the above options are correct

Question 2: Select the correct parameter used to change the line width in a line graph using the geom_line() method?

  • line_size
  • size
  • line_width
  • width

Question 3: Which parameter out of the following represents the Confidence Interval in Regression?

  • confidence_interval
  • se
  • ci
  • lm

Question 1: Select the correct option for the values of Median, Lower whisker, Upper whisker, First quartile, Third quartile for the dataset: 3, 5, 7, 8, 12, 13, 14, 18, 21?

  • 33, 2, 5, 12, 18
  • 6, 2, 22, 7, 2
  • 12, 4, 2, 3, 17
  • 12, 3, 21, 6, 16

Question 2: >> True or False: To create waffle charts in R, we use ggplot library which is used for graphs and also waffle library.

  • True
  • False

Question 3: When working with Radar Charts in R, what is the correct code used to suppress the warnings generated?

  • (warn = -1)
  • (warn = 1)
  • options(warn = -1)
  • None of the options are correct

Question 1: Which function gives an object that represents an empty world map.

  • addMarkers
  • addTiles
  • leaflet
  • None of the options are correct

Question 2: What is the use of the method addTiles() in R?

  • To divide map in tiles.
  • To zoom in the map to see different countries and streets in detail.
  • To create tiles view of map.
  • All the options above are correct

Question 3: ___________ method is used to publish a tile layer on the map.

  • leaf()
  • leaflet()
  • addTiles()
  • None of the above options are correct

Question 1: Which function is used to create the display of shiny app?

  • display()
  • output functions
  • fluidPage()
  • input functions

Question 2: Which argument is used to position sliderbar on the right hand side in shiny app?

  • align=”right”
  • position=”right”
  • position = “rightalign”
  • sliderLayout(position=”right”)

Question 3: >>What does the ui.R file in R contain?

  • inputs for server.R
  • layout and appearance of app.
  • instructions to build output object.
  • All the above options are correct

Question 1: Which of the following options indicate the features that make R suitable for Data Visualizations

  • R is a free and open source tool
  • Built for statistical computing
  • Visualization Tools
  • All the options above are correct

Question 2: if(“ggplot2” %in% rownames(installed.packages()) == FALSE) {install.packages(“ggplot2”)}library(ggplot2) Please select the correct explanation for the code from the following options

  • Check if “ggplot2” library is already installed into R, if not then install it and load it into R environment
  • Load the “ggplot2”library into R environment
  • Install and load the “ggplot2” library into R environment
  • Install the “ggplot2” library into R

Question 3: We want to create a Bar Graph with black filled bars, x and y axis labels as Cylinders and Number of cars respectively and outline color of bars as Red. Choose the correct code block from below which will create the desired graph.

  • qplot(mtcars$cyl, geom = “bar”, fill = I(“black”), xlab = “Cylinders”, ylab = “Number of Cars”, colour = I(“red”))
  • qplot(mtcars$cyl, geom = “histogram”, fill = I(“black”), xlab = “Cylinders”, ylab = “Number of Cars”, colour=I(“red”))
  • qplot(mtcars$cyl, fill = I(“black”), xlab = “Cylinders”, ylab=”Number of Cars”, outline=I(“red”)
  • None of the options are correct

Question 4: Choose the correct parameter which will define the width of the bars in a Histogram.

  • binwidth
  • barWidth
  • bar_width(value)
  • width
  • None of the options are correct

Question 5: A pie chart in ggplot2 is a transformed stacked bar plot. Select the correct function from the following options to convert a stacked bar plot into a pie chart?

  • pieChart (theta=’y’)
  • coord_polar(theta=’y’)
  • transform(theta=’y’)
  • None of the above options are correct

Question 6: Let’s assume we have the mtcars dataset and we want to create a Scatter Plot by using mpg and wt columns of this dataset. Select the correctcode from the options below which can create the plot for us with red colored points.

  • ggplot(mtcars,aes(x=mpg,y=wt)) + geom_point()
  • ggplot(mtcars,aes(x=mpg,y=wt)) + geom_point(shape=19, colour=”red”)
  • ggplot(mtcars,aes(x=mpg,y=wt)) + geom_point(shape=19, “blue”)
  • None of the options above are correct

Question 7: True or False: It is possible plot more than one line at a time in the same graph using the ggplot() method

  • False
  • True

Question 8: Choose the correct statement from the following options

  • se parameter is used to display confidence interval
  • There is no term Confidence Interval in Regression
  • If you want to display confidence interval then either just ignore the se attribute, or set it to TRUE
  • None of above options are correct

Question 9: Suppose we want to download a .csv file from the link below, https://ibm.box.com/shared/static/cmid70rpa7xe4ocitcga1bve7r0kqnia.csv and store it with name my_data.csv in “/resources/data/” folder. Select the correct code from the options below

  • file(“https://ibm.box.com/shared/static/cmid70rpa7xe4ocitcga1bve7r0kqnia.csv”, “/resources/data/my_data.csv”)
  • download.file(“https://ibm.box.com/shared/static/cmid70rpa7xe4ocitcga1bve7r0kqnia.csv”, destfile = “/resources/data/my_data.csv”)
  • download(“https://ibm.box.com/shared/static/cmid70rpa7xe4ocitcga1bve7r0kqnia.csv”, destfile = “/resources/data/my_data.csv”)
  • None of the options are correct

Question 10: Select the correct format from the following options to create a word cloud with a minimum frequency value 1 and maximum words 200?

  • wordcloud(words = data, freq = frequency, min.freq = 1, max.words=200)
  • wordcloud(data, frequency, minimun= 1, max.words=200)
  • wordcloud(freq = frequency, min.freq = 1, maxWords=200)
  • wordcloud(words = data, freq = frequency, min.freq = 1)

Question 11: Select the correct option to create a WordCloud that is centered?

  • order = FALSE
  • random.order = TRUE
  • random.order = FALSE
  • random = TRUE

Question 12: dplyr and Scales libraries in a Radar Chart are used for?

  • filtering the dataset
  • provides convenient viewing and utility functions
  • pipe operations and to determine labels respectively
  • None of the options are correct

Question 13: Which method is used to avoid displaying warnings, generated while Creating a Radar Chart?

  • options(warns=-1)
  • warns(-1)
  • options(warn=-1)
  • warnings(-1)

Question 14: ___________ can be used to adjust the size of Waffle Charts

  • kernel
  • IRkernel
  • Ikernel
  • None of the options are correct

Question 15: >> Which of the following parameters are used to create waffle charts in R?

  • colors
  • rows
  • title
  • xlab
  • All the options above are correct

Question 16: Choose the correct method to create a Box Plot in R

  • ggplot(df) + geom_boxplot()
  • ggplot(df, aes(x=label, y=value))
  • ggplot(df, aes(x=label, y=value)) + geom_boxplot()
  • None of the options are correct

Question 17: What is the term used to indicate the difference between the first and third quartiles?

  • lower whisker and upper whisker.
  • first quartile
  • third quartile
  • Interquartile Range

Question 18: Which function gives an object that represents an empty world map

  • addMarkers
  • addTiles
  • leaflet
  • All the options above are correct

Question 19: What is the use of the method addTiles() in R?

  • To divide map in tiles.
  • To zoom in the map to see different countries and streets in detail.
  • To create tiles view of map.
  • All the options above are correct

Question 20: Which function is used to create display of shiny app?

  • display()
  • output functions
  • fluidPage()
  • input functions

You may also like

Leave a Comment

Indian Success Stories Logo

Indian Success Stories is committed to inspiring the world’s visionary leaders who are driven to make a difference with their ground-breaking concepts, ventures, and viewpoints. Join together with us to match your business with a community that is unstoppable and working to improve everyone’s future.

Edtior's Picks

Latest Articles

Copyright © 2024 Indian Success Stories. All rights reserved.