[R] ggplot rank stack bar automatically.
R. Michael Weylandt
michael.weylandt at gmail.com
Thu Feb 16 03:21:56 CET 2012
It looks like period is a factor, so you can reorder the factor levels
however you wish and then plot them the same way. I believe recode()
in library(car) is a popular function for doing this, but I haven't
used it myself.
Michael
On Wed, Feb 15, 2012 at 11:34 AM, vd3000 <vd3000 at yahoo.co.uk> wrote:
> Hi, all,
>
> I am currently trying to learn this example.
> http://learnr.wordpress.com/2009/03/17/ggplot2-barplots/
>
>
> I created the stack bar easily.
>
> If I would like to rank the stack bar from the highest on the right,
> shortest on the left and eventually
> I could show the data "1991-00" on the left and "1823-30" on the right, how
> could I do that?
>
> Apart from this, I find something quite weird,
> If I import a data frame with column names containing \n, for example,
> pretty\nwoman, lemon\ntree, etc
> for example: f3=as.data.frame(read.table("f3.csv", sep=",", row.names=1,
> header=TRUE, check.names=FALSE))
> even I put check.names=FALSE, the column name will be changed to \\n, ie,
> pretty\\nwoman, lemon\\ntree.
> How could I get rid of extra "\" sign ???
>
>
>
> Hope some genius could help.
>
> Thanks in advance.
>
> vd
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/ggplot-rank-stack-bar-automatically-tp4391042p4391042.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list