简体   繁体   中英

Barplots Not Plotting Frequency Correctly in R

Struggling to plot a barplot where the height of each bar is related to the value in a column (in this case, freq). Table name is Tag_Count_2

Tag.1  freq
Hello  3
My     4
Name   10

I tried:

Counts<-table(Tag_Count_2$freq)
barplot(Counts)

But it plots the # of times values under Tag.1 share the same freq. I also tried:

barplot(Tag_Count_2, height=freq)

But it said freq wasn't found.

Are you looking for

barplot(Tag_Count_2$freq)

You don't need the table command in this case as you already have the frequency .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM