I am trying to build a histogram with two datasets using ggplot2. My dataset has 418 values ββto plot, with two groups of data (so there will be two sets of color bars on my histogram). Annoyingly, I cannot reproduce the iris dataset issue:
library(ggplot2) ggplot(iris, aes(x=iris[,1], fill=iris[,5])) + geom_histogram(binwidth=.5,alpha=.5)
This creates a subtle histogram. When I try this according to my data, I get:
Error : cannot allocate vector of size 4.0 Gb In addition: Warning messages: 1: In anyDuplicated.default(breaks) : Reached total allocation of 16366Mb: see help(memory.size) 2: In anyDuplicated.default(breaks) : Reached total allocation of 16366Mb: see help(memory.size) 3: In anyDuplicated.default(breaks) : Reached total allocation of 16366Mb: see help(memory.size) 4: In anyDuplicated.default(breaks) : Reached total allocation of 16366Mb: see help(memory.size) Error in UseMethod("scale_dimension") : no applicable method for 'scale_dimension' applied to an object of class "NULL"
I have 16 GB of memory, so creating a patch with 418 data points should not be a problem.
Any help is greatly appreciated.
It turns out that my data will still not be displayed, even if it refers to column names. I think this is due to the data range. After the log converts the data, graph the histogram. It seems that ggplot2 or R as a whole does not like the range 1-165476109, which is understandable ...
source share