R 使用ggplot2绘制可变频率

R 使用ggplot2绘制可变频率,r,ggplot2,R,Ggplot2,我想画一个条形图,显示ggplot中字符串的频率。输入文件(t1.txt)如下所示: do 4 re 2 mi 5 我当前的r脚本是: library("ggplot2") t1<-read.table("t1.txt",header=FALSE,sep='\t') ggplot(t1,aes(V1))+geom_bar() 库(“ggplot2”) t1您需要做的就是将实际的V2放入命令中。aes的默认前两项是x和y。你只给了x ggplot(t1,aes(V1,V2))+ge

我想画一个条形图,显示ggplot中字符串的频率。输入文件(t1.txt)如下所示:

do  4
re  2
mi  5
我当前的r脚本是:

library("ggplot2")
t1<-read.table("t1.txt",header=FALSE,sep='\t')
ggplot(t1,aes(V1))+geom_bar()
库(“ggplot2”)

t1您需要做的就是将实际的V2放入命令中。aes的默认前两项是x和y。你只给了x

ggplot(t1,aes(V1,V2))+geom_bar()