meteorBuzz
meteorBuzz

Reputation: 3200

Make a histogram who's frequency is a value in the row

How can I make a histogram so that each row below is represented by a bar? Eg, x axis "2012-10-02" and y axis "126", "2012-10-03" and y axis "11352"... and so on.

The 'date' variable is a Date vector.

         date steps
1  2012-10-02   126
2  2012-10-03 11352
3  2012-10-04 12116
4  2012-10-05 13294
5  2012-10-06 15420
6  2012-10-07 11015
7  2012-10-09 12811
8  2012-10-10  9900
9  2012-10-11 10304
10 2012-10-12 17382

Thank you

Upvotes: 0

Views: 98

Answers (1)

C8H10N4O2
C8H10N4O2

Reputation: 19005

This is not a histogram. You've already aggregated the counts by date.

barplot(df$steps, names = df$date,
        xlab = "Date", ylab = "Steps",
        main = "Your title here")

enter image description here

Upvotes: 7

Related Questions