Displaying 3 results from an estimated 3 matches for "bartsmeets86".
2012 Mar 15
2
Ggplot barchart drops factor levels: how to show them with zero counts?
Hello,
When plotting a barchart with ggplot it drops the levels of the factor for
which no counts are available.
For example:
library(ggplot)
mtcars$cyl<-factor(mtcars$cyl)
ggplot(mtcars[!mtcars$cyl==4,], aes(cyl))+geom_bar()
levels(mtcars[!mtcars$cyl==4,])
This shows my problem. Because no counts are available for factorlevel '4',
the label 4 dissapears from the plot. However, I
2012 Jan 20
1
Stacked barchart in ggplot (or other library)
Hey,
I want to create a stacked barchart in R for the following dataset
(http://pastebin.com/pyHUNgr2):
# usage capacity diff
1 4 10 6
2 2 20 18
3 5 10 5
The stacked barchart should, in one plot show each line of the dataset as a
stacked bar using data from 'usage' and 'diff' to create the stacked bar.
I can't find a good example of how to do this on the ggplot2 site.
2012 Apr 12
1
Generate combination of strings
Hey all,
I am trying to generate a number of vectors with string combinations. The
below code solves my initial problem, however I would prefer not hardcoding
the positions of the 'objects' as in the future the number of 'objects'
could increase. Is there a way to loop over these objects and generate the
same output? The same goes for the 'maxspacer'.
Thanks a whole