www.HadoopExam.com

HadoopExam Learning Resources

Question 19 : In R, functions like plot() and hist() are known as what?

1.  generic functions
2.  virtual methods
3.  virtual functions
4.  generic methods


Correct Answer : 2 Exp:  You can create histograms with the function hist(x) where x is a numeric vector of values to be plotted. The option freq=FALSE plots probability densities instead of frequencies. The option breaks= controls the number of bins. Histograms are used very often in public health to show the distributions of your independent and dependent variables.  Although the basic command for histograms (hist()) in R is simple, getting your histogram to look exactly like you want takes getting to know a few options of the plot.  Here I present ways to customize your histogram for your needs.

First, I want to point out that ggplot2 is a package in R that does some amazing graphics, including histograms.  I will do a post on ggplot2 in the coming year.   However, the hist() function in base R is really easy and fast, and does the job for most of your histogram-ing needs. However, if you want to do complicated histograms, I would recommend reading up on ggplot2.

Okay so for our purposes today, instead of importing data, I'll create some normally distributed data myself. In R, you can generate normal data this way using the rnorm() function:

BMI < -rnorm(n=1000, m=24.2, sd=2.2)

So now we have some BMI data, and the basic histogram plot that comes out of R looks like this:

hist(BMI)

You have no rights to post comments

Comments   

+1 # Data Science Certification PreparationLalit Pawar 2015-05-01 16:43
Team, thanks for providing such a good material. Your explanation to questions are the best thing which I have ever found. Perfect material to get certified on EMC Data Science
0 # In R, functions like plot() and hist() are known as what?avitron 2015-06-08 05:25
A generic function is a
group of functions sharing the same name but behaving differently depending on the
number and the type of arguments they receive. Utilized previously, plot() is another
example of a generic function; the plot is determined by the passed variables.

from "Data Science & Big Data Analytics
Discovering, Analyzing, Visualizing and Presenting Data"
0 # Data science training in bangaloreijaz 2017-11-27 09:08
Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
You are here: Home EMC Certification EMC Data Science EMC Data Science Question 19 : In R, functions like plot() and hist() are known as what?