Sorry Maryam but I use neither reshape nor ggplot2 so I will leave it to others to advise you.

On 09/01/2016 14:29, maryam moazam wrote:

Dear Michael,

Thanks for your feedback. Actually, I would like to show (and compare)
size distribution of df1 and df2 in the single plot using ggplot2,
something like the attached picture. The command dosesn't lead me to
this purpose. However, I'm really new here, could you please help
me more on this?


Thanks in advance,
Maryam





On Sat, Jan 9, 2016 at 5:38 PM, Michael Dewey <li...@dewey.myzen.co.uk
<mailto:li...@dewey.myzen.co.uk>> wrote:

    Dear Maryam

    If you just need all the values of size would
    c(df1$size, df2$size)
    work?

    On 08/01/2016 21:44, maryam moazam wrote:

        Dear Sir / Madam,

        I have just come to the amazing R software, so please be patient
        if my
        question is basic for you. I have 2 text file (say 1.txt and
        2.txt), each
        file containing 2 columns and different row numbers, like below

        case size
        case1 120
        case2 120
        case3 121
        case4 121
        case5 121
        case6 122
        case7 122
        case8 123

        I would like to have a one plot for all text files, with x-axis
        shows the
        size between 300-1200 with the interval of 200
        (300,500,700,900,1200) and
        size between 1201-1500 with the interval of 1000. For dataframes
        with the
        equal row numbers, the following codes worked well,

        df1 = data.frame("1.txt", header=T)
        df2 = data.frame("2.txt", header=T)
        *combining two dataframes with equal row number*

        df = data.frame(df1$size,df2$size)
        library(reshape)
        melted <- melt(df)

        ggplot(data=melted, aes(value))+aes(fill=variable)+ geom_histogram
        (binwidth =500)+

        
+scale_x_continuous(breaks=c(seq(300,1000,by=200),seq(1001,15000,by=1000)))


        but I couldn't reproduce the plot with these codes for
        dataframes with
        different row number. I think the problem is* how to combine
        datafrmaes
        with the different row number*, could you please help me out on
        this issue?

        Thank you in advance

                 [[alternative HTML version deleted]]

        ______________________________________________
        R-help@r-project.org <mailto:R-help@r-project.org> mailing list
        -- To UNSUBSCRIBE and more, see
        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.


    --
    Michael
    http://www.dewey.myzen.co.uk/home.html




--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to