简体   繁体   中英

Statistical Analysis with chars in R

I'm wondering how to make an analysis with chars in R, specifically with a barplot or ggPlot. If I have a read excel file that contains a list like below, how could I make a barplot with it since the data is not in chars to count the number of occurrences the name appears in a bar plot?

Most Popular Names
John
Tim
John
Tim
Cole
Cody

You can retrieve the frequency of each name in column 'Most Popular Names' with the table() function. This data can be used to build up a barplot.

data <- data.frame(`Most Popular Names` = c("John", "Tim", "John", "Tim", "Cole","Cody"))
barplot(table(data))

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