Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将如何使用 R 绘制非数值数据频率的条形图?
例如,如果给定v = c("B","A","B","A","B","D","C","D","D","D","C")
v = c("B","A","B","A","B","D","C","D","D","D","C")
我想得到一个条形图,其中每个条形代表向量中的一个唯一值,每个条形的高度与该值的频率相对应:
Calculate the table of values for the barplot using the table() function, e.g.:
table()
v <- c("B","A","B","A","B","D","C","D","D","D","C") barplot(table(v))
This produces