How to create a histogram in R

0 votes

Hi Guys,

I am new to R. I am learning how to draw graphs in R. How can I do that?

Oct 30, 2020 in Data Analytics by MD
• 95,440 points
709 views

1 answer to this question.

0 votes

Hi@MD,

A histogram represents the frequencies of values of a variable bucketed into ranges. The histogram is similar to a bar chart but the difference is it groups the values into continuous ranges. A simple histogram is created using input vector, label, col, and border parameters. The script given below will create and save the histogram in the current R working directory.

v <-  c(9,13,21,8,36,22,12,41,31,33,19)
png(file = "histogram.png")
# Create the histogram.
hist(v,xlab = "Weight",col = "yellow",border = "blue")
answered Oct 30, 2020 by akhtar
• 38,230 points

Related Questions In Data Analytics

0 votes
1 answer

How to create dummy variables based on a categorical variable of lists in R?

You can use mtabulate in the following way: library(qdapTools) cbind(data[1], ...READ MORE

answered Apr 13, 2018 in Data Analytics by CodingByHeart77
• 3,740 points
2,292 views
0 votes
1 answer

How to create a box-plot using “plotly” in R?

You can use this command to create ...READ MORE

answered Jul 4, 2018 in Data Analytics by CodingByHeart77
• 3,740 points
7,159 views
0 votes
1 answer

How to create a new R6 Class in R?

You have to first create an object ...READ MORE

answered Jul 5, 2018 in Data Analytics by DataKing99
• 8,240 points
1,037 views
+1 vote
1 answer

How to create a 2D array of vectors of different lengths in R programming?

You can try making a list of matrices ...READ MORE

answered Feb 1, 2019 in Data Analytics by Sophie may
• 10,610 points
1,264 views
0 votes
2 answers

How to create a table in R without external file?

Tibble also creates a table-like structure. Use below ...READ MORE

answered Sep 3, 2019 in Data Analytics by anonymous
• 33,030 points
2,619 views
+10 votes
3 answers

Which is a better initiative to learn data science: Python or R?

Well it truly depends on your requirement, If ...READ MORE

answered Aug 9, 2018 in Data Analytics by Abhi
• 3,720 points
1,119 views
+1 vote
1 answer

Error saying "vector size cannot be NA" when using R with data mining

You can use the removesparseterm function.  Removes sparse ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,840 points
4,371 views
+1 vote
2 answers
0 votes
1 answer

Trying to find frequent itemsets of a data set using arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", "milk", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,840 points
549 views
+1 vote
2 answers

How to replace a value in a data frame based on a conditional 'If' statement?

It's easier to convert alpha to characters ...READ MORE

answered Jun 6, 2018 in Data Analytics by Sahiti
• 6,370 points
36,268 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP