Hi,
I am not getting any errors.
data_chir <- read.table(text="N1_re N2_re N3_re
yes no no
no yes no
na yes yes
no na
no",sep="",header=TRUE,stringsAsFactors=FALSE,na.strings="na")
library(reshape2)
melt(data_chir, measure.vars=c("N1_re", "N2_re"),
var="zpd")
? N3_re?? zpd value
1??? no N1_re?? yes
2??? no N1_re??? no
3?? yes N1_re? <NA>
4??? no N1_re??? no
5??? no N2_re??? no
6??? no N2_re?? yes
7?? yes N2_re?? yes
8??? no N2_re? <NA>
A.K.
On Saturday, November 23, 2013 5:02 PM, maggy yan <kiotoqq at gmail.com>
wrote:
sorry, I forgot that.. the variables look like this:
N1_re N2_re N3_re
yes no no
no yes no
na ye yes
no na no
2013/11/23 arun <smartpink111 at yahoo.com>
Hi,>You need to make a reproducible example for others to understand the error.?
>?set.seed(49)
>?data_chir <-
data.frame(N1_re=sample(c(NA,"yes","no"),100,replace=TRUE),N2_re=sample(c(NA,"yes","no"),100,replace=TRUE),stringsAsFactors=FALSE)
>?melt(data_chir, measure.vars=c("N1_re", "N2_re"),
var="zpd") #no errors here.
>
>
>A.K.
>
>
>
>
>
>On Saturday, November 23, 2013 10:07 AM, maggy yan <kiotoqq at
gmail.com> wrote:
>I want to make a stacked bar plot with one bar for two variables from my
>data "chir", the two variables have about 100 values like no, yes
and na. I
>want to show how many no, yes and na they both have together with the
>stacked bar. I tried to melt these to variables first like this:
>
>melt1=melt(data_chir, measure.vars=c("N1_re", "N2_re"),
var="zpd")
>
>but it says " arguments imply differing number of rows: 98, 196"
>
>
>maybe there is another way to make the plot without melt?
>
>thanks in advance!
>
>??? [[alternative HTML version deleted]]
>
>______________________________________________
>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.
>
>