2014-02-14 104 views
0

使用GGPLOT2 1个变量的我的数据集,其矩阵界定如下multiple obs. of 1 variables绘制多个obs。 R中

>GC_percent 
[1,] 0.4835822 
[2,] 0.4782782 
[...] 
[5622,] 0.4968492 
[5623,] 0.5076531 

而且我会画一个柱状图与这一个:

qplot(GC_percent, geom="histogram") 

但不可避免的是它不工作:

Error: ggplot2 doesn't know how to deal with data of class matrix 
+0

ggplot2需要一个data.frame。给它一个。 – Roland

回答

1

正如罗兰说,GGPLOT2需要一个数据帧:

GC_percent <- as.data.frame(GC_percent) 
qplot(GC_percent, geom="histogram")