R中的频率图例如数据集
我拥有数据集,就像
Name,School,Grade,Hobby,Addr1,Addr2,State
Sanjay1,BiharSchool1,11,"Cricket,Hockey,Badminton",xxxx,India,Bihar
Sanjay2,UpSchool1,11,"Volleyball,Hockey,Football",xxxx,India,UP
Sanjay3,BiharSchool2,11,"Boxing",xxxx,India,Bihar
Sanjay4,MPSchool1,11,"Cricket,Hockey,Badminton",xxxx,India,MP
Sanjay5,BiharSchool3,11,"Boxing",xxxx,India,Bihar
Sanjay6,MPSchool1,11,"Cricket,Hockey,Badminton",xxxx,India,MP
在那里一样,我可以为以下要求创建图表
- 显示状态名称和不同数量的学校频率。像上面的显示,比哈尔邦州有3个不同的学校,UP&国会议员有一所学校(甚至国会议员都有两个记录,但学校名称相同)
- 显示了爱好频率,例如板球 - 3次,曲棍球-4次,拳击2次等等
I had the Dataset like
Name,School,Grade,Hobby,Addr1,Addr2,State
Sanjay1,BiharSchool1,11,"Cricket,Hockey,Badminton",xxxx,India,Bihar
Sanjay2,UpSchool1,11,"Volleyball,Hockey,Football",xxxx,India,UP
Sanjay3,BiharSchool2,11,"Boxing",xxxx,India,Bihar
Sanjay4,MPSchool1,11,"Cricket,Hockey,Badminton",xxxx,India,MP
Sanjay5,BiharSchool3,11,"Boxing",xxxx,India,Bihar
Sanjay6,MPSchool1,11,"Cricket,Hockey,Badminton",xxxx,India,MP
Is there way I can create Chart for the following requirements
- Show State Name and Different Number of School Frequency. Like Above shows Bihar State has 3 different School, UP & MP has one school ( Even MP has two record but School name is same)
- Show Hobbies Frequency like Cricket- 3times, Hockey-4 times, Boxing-2 times and so on
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1.
School
的条形图通过状态
计数通过
hobby
将行分开,并计算所需的事件。然后将管道带到条形图。在2022-05-27上由 reprex软件包(v2.0.1)
1.B
School> School> School> School> by
state> state
在2022-05-28上创建的 reprex软件包(v2.0.1)
2
。计算行爱好频率。和管道到条形图。
由 reprex软件包(v2.0.1)
1.a Bar plot of
School
counts byState
Separate the rows by
Hobby
, and count the needed occurrences. Then pipe to a bar plot.Created on 2022-05-27 by the reprex package (v2.0.1)
1.b Count of
School
byState
Created on 2022-05-28 by the reprex package (v2.0.1)
2. Bar plot of
Hobby
The same as above, separate the rows by
Hobby
, then compute the rows hobbies frequencies. And pipe to a bar chart.Created on 2022-05-27 by the reprex package (v2.0.1)