用2个数组创建直方图 [英] Creating histogram plot with 2 arrays

查看:75
本文介绍了用2个数组创建直方图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在R中使用此数据创建直方图?

How can I create a histogram with this data in R?

f = c('0-5', '6-10', '11-15', '16-20', '> 20')
counts_arr = c(0, 8, 129, 127, 173)

现在, counts_arr [0] f [0]

所以我试图将 f 放在X轴上,将 counts_arr 值放在Y轴上

So I am trying to get f to be on the X axis and counts_arr values on the Y axis

推荐答案

barplot(counts_arr, names = f)

这篇关于用2个数组创建直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆