Plotting two categories in ggplot2 violin R -


i have data set different categories. let's a,b,c , d.

here how data set looks like

        v1   v2    v3     1   na    1   0.1     2    2    2   0.2     3    3   na   0.1     4    4    4   0.3     5   na   na   0.4     6   na   na   0.8     7    7    7   0.2     8   na    8   0.1     9    9   na   0.6     10  na   na   0.1 

the lines that:

v1 column not na in category a

v2 column not na in category b

(v1 column not na or v2 column not na )are in category c

all line in dataframe in category d

in case of example above: there lines fall , c @ same time(like line 3). line 1 in category b , c. therefore, number of category c may less number of a+b. 10 lines in category d.

i want use ggplot2 plot violin plot of category a,b,c , d according values in v3. (that b c d in x-axis , v3 in y-axis)

does got hint? tried ggplot2 seems can't not deal overlapped categories. if data have column specified categories, work fine:

        v1   v2    v3    group     1   na    1   0.1        b     2    2    2   0.2        c     3    3   na   0.1            4    4    4   0.3        c     5   na   na   0.4        d     6   na   na   0.8        d     7    7    7   0.2        c     8   na    8   0.1        b     9    9   na   0.6            10  na   na   0.1        d 

there 4 violin in each violin there entries in category. overlapped ones not taken account.

is there way plot overlap categories in ggplot2? or there way plot different categories different dataframes 1 violin plot? or suggest plot 4 subset of original data set , combine 4 violin plots together?

thanks lot!

it's easy construct categories want.

data:

dd <- read.table(text="    na    1   0.1     2    2   0.2     3   na   0.1     4    4   0.3    na   na   0.4    na   na   0.8     7    7   0.2    na    8   0.1     9   na   0.6    na   na   0.1") 

transformation:

dd$group <- with(dd,   ifelse(is.na(v1) & is.na(v2),"d",          ifelse(!is.na(v1) & !is.na(v2),"c",                 ifelse(is.na(v1),"b","a")))) 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -