Multiple Histograms in R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple Histograms in R

prateek
Hi,

I have a data as mentioned below(at the bottom)

Now out of that data i have to create multiple histograms in a single view
in  R. On that histogram i need on x -axis binned data with Breaks 10 and
on y axis event rate . Here churn is dependent variable.


*for example, for mou_mean , on x -axis on histogram i need Bins(mou_mean)
and on y - axis in need Churn%age. *
*Bins(mou_mean)*

*Churn %age*
23-43                                          0.23%
33-53                                          0.5%
43-63                                           0.3%
53-73                                           0.4%
63-83                                           0.7%
83-103                                        0.8%

Please help


*mou_mean*

*totalmrc_mean*

*rev_range*

*mou_range*

*Churn*

23

24

25

27

1

45

46

47

49

1

43

44

45

47

1

45

46

47

49

0

56

57

58

60

0

67

68

69

71

1

67

68

69

71

0

44

45

46

48

1

33

34

35

37

0

90

91

92

94

1

87

88

89

91

1

76

77

78

80

1

33

34

35

37

1

44

45

46

48

1

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Multiple Histograms in R

Rui Barradas
Hello,

Maybe package psych, function multi.hist is what you want.

https://cran.r-project.org/web/packages/psych/index.html

And don't post in HTML, your data is unreadable.

Hope this helps,

Rui Barradas

Em 19-04-2017 14:05, prateek pande escreveu:

> Hi,
>
> I have a data as mentioned below(at the bottom)
>
> Now out of that data i have to create multiple histograms in a single view
> in  R. On that histogram i need on x -axis binned data with Breaks 10 and
> on y axis event rate . Here churn is dependent variable.
>
>
> *for example, for mou_mean , on x -axis on histogram i need Bins(mou_mean)
> and on y - axis in need Churn%age. *
> *Bins(mou_mean)*
>
> *Churn %age*
> 23-43                                          0.23%
> 33-53                                          0.5%
> 43-63                                           0.3%
> 53-73                                           0.4%
> 63-83                                           0.7%
> 83-103                                        0.8%
>
> Please help
>
>
> *mou_mean*
>
> *totalmrc_mean*
>
> *rev_range*
>
> *mou_range*
>
> *Churn*
>
> 23
>
> 24
>
> 25
>
> 27
>
> 1
>
> 45
>
> 46
>
> 47
>
> 49
>
> 1
>
> 43
>
> 44
>
> 45
>
> 47
>
> 1
>
> 45
>
> 46
>
> 47
>
> 49
>
> 0
>
> 56
>
> 57
>
> 58
>
> 60
>
> 0
>
> 67
>
> 68
>
> 69
>
> 71
>
> 1
>
> 67
>
> 68
>
> 69
>
> 71
>
> 0
>
> 44
>
> 45
>
> 46
>
> 48
>
> 1
>
> 33
>
> 34
>
> 35
>
> 37
>
> 0
>
> 90
>
> 91
>
> 92
>
> 94
>
> 1
>
> 87
>
> 88
>
> 89
>
> 91
>
> 1
>
> 76
>
> 77
>
> 78
>
> 80
>
> 1
>
> 33
>
> 34
>
> 35
>
> 37
>
> 1
>
> 44
>
> 45
>
> 46
>
> 48
>
> 1
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Multiple Histograms in R

Bert Gunter-2
Also, *if* this is homework, don't post at all, as this list is not
for doing homework (though, for better or worse, sometimes such help
is provided).


-- Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Apr 19, 2017 at 6:20 AM, Rui Barradas <[hidden email]> wrote:

> Hello,
>
> Maybe package psych, function multi.hist is what you want.
>
> https://cran.r-project.org/web/packages/psych/index.html
>
> And don't post in HTML, your data is unreadable.
>
> Hope this helps,
>
> Rui Barradas
>
>
> Em 19-04-2017 14:05, prateek pande escreveu:
>>
>> Hi,
>>
>> I have a data as mentioned below(at the bottom)
>>
>> Now out of that data i have to create multiple histograms in a single view
>> in  R. On that histogram i need on x -axis binned data with Breaks 10 and
>> on y axis event rate . Here churn is dependent variable.
>>
>>
>> *for example, for mou_mean , on x -axis on histogram i need Bins(mou_mean)
>> and on y - axis in need Churn%age. *
>> *Bins(mou_mean)*
>>
>> *Churn %age*
>> 23-43                                          0.23%
>> 33-53                                          0.5%
>> 43-63                                           0.3%
>> 53-73                                           0.4%
>> 63-83                                           0.7%
>> 83-103                                        0.8%
>>
>> Please help
>>
>>
>> *mou_mean*
>>
>> *totalmrc_mean*
>>
>> *rev_range*
>>
>> *mou_range*
>>
>> *Churn*
>>
>> 23
>>
>> 24
>>
>> 25
>>
>> 27
>>
>> 1
>>
>> 45
>>
>> 46
>>
>> 47
>>
>> 49
>>
>> 1
>>
>> 43
>>
>> 44
>>
>> 45
>>
>> 47
>>
>> 1
>>
>> 45
>>
>> 46
>>
>> 47
>>
>> 49
>>
>> 0
>>
>> 56
>>
>> 57
>>
>> 58
>>
>> 60
>>
>> 0
>>
>> 67
>>
>> 68
>>
>> 69
>>
>> 71
>>
>> 1
>>
>> 67
>>
>> 68
>>
>> 69
>>
>> 71
>>
>> 0
>>
>> 44
>>
>> 45
>>
>> 46
>>
>> 48
>>
>> 1
>>
>> 33
>>
>> 34
>>
>> 35
>>
>> 37
>>
>> 0
>>
>> 90
>>
>> 91
>>
>> 92
>>
>> 94
>>
>> 1
>>
>> 87
>>
>> 88
>>
>> 89
>>
>> 91
>>
>> 1
>>
>> 76
>>
>> 77
>>
>> 78
>>
>> 80
>>
>> 1
>>
>> 33
>>
>> 34
>>
>> 35
>>
>> 37
>>
>> 1
>>
>> 44
>>
>> 45
>>
>> 46
>>
>> 48
>>
>> 1
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Multiple Histograms in R

Jim Lemon-4
In reply to this post by prateek
Hi Prateek,
There is some difficulty with including the empty categories in the
factors generated. I couldn't get these even with drop=FALSE, so I had
to go through the "xtab" function. You can do it with the "table"
function in the base package, but it is a little more trouble. See if
this is what you want>

ppdat<-read.table(text="mou_mean,totalmrc_mean,rev_range,mou_range,Churn
23,24,25,27,1
45,46,47,49,1
43,44,45,47,1
45,46,47,49,0
56,57,58,60,0
67,68,69,71,1
67,68,69,71,0
44,45,46,48,1
33,34,35,37,0
90,91,92,94,1
87,88,89,91,1
76,77,78,80,1
33,34,35,37,1
44,45,46,48,1",
sep=",",header=TRUE)
ppdat$mou_mean_cut<-cut(ppdat$mou_mean,breaks=seq(23,103,10),include.lowest=TRUE)
ppdat$totalmrc_mean_cut<-cut(ppdat$totalmrc_mean,breaks=seq(23,103,10))
ppdat$rev_range_cut<-cut(ppdat$rev_range,breaks=seq(23,103,10))
ppdat$mou_range_cut<-cut(ppdat$mou_range,breaks=seq(23,103,10))
library(prettyR)
ppx<-xtab(Churn~mou_mean_cut,ppdat)
mou_mean_agg<-100*ppx$counts[2,]/colSums(ppx$counts)
mou_mean_agg[is.nan(mou_mean_agg)]<-0
ppx<-xtab(Churn~totalmrc_mean_cut,ppdat)
totalmrc_mean_agg<-100*ppx$counts[2,]/colSums(ppx$counts)
totalmrc_mean_agg[is.nan(totalmrc_mean_agg)]<-0
ppx<-xtab(Churn~rev_range_cut,ppdat)
rev_range_agg<-100*ppx$counts[2,]/colSums(ppx$counts)
rev_range_agg[is.nan(rev_range_agg)]<-0
ppx<-xtab(Churn~mou_range_cut,ppdat)
mou_range_agg<-100*ppx$counts[2,]/colSums(ppx$counts)
mou_range_agg[is.nan(mou_range_agg)]<-0
ppmat<-matrix(c(mou_mean_agg,totalmrc_mean_agg,rev_range_agg,
 mou_range_agg),nrow=4,byrow=TRUE)
library(plotrix)
barp(ppmat,col=rainbow(4),main="Multiple histogram",ylim=c(0,105),
 names.arg=levels(ppdat$mou_mean_cut),ylab="Percent churn")
legend(2.5,107,c("mou_mean","totalmrc_mean","rev_range","mou_range"),
 fill=rainbow(4))

Jim


On Wed, Apr 19, 2017 at 11:05 PM, prateek pande <[hidden email]> wrote:

> Hi,
>
> I have a data as mentioned below(at the bottom)
>
> Now out of that data i have to create multiple histograms in a single view
> in  R. On that histogram i need on x -axis binned data with Breaks 10 and
> on y axis event rate . Here churn is dependent variable.
>
>
> *for example, for mou_mean , on x -axis on histogram i need Bins(mou_mean)
> and on y - axis in need Churn%age. *
> *Bins(mou_mean)*
>
> *Churn %age*
> 23-43                                          0.23%
> 33-53                                          0.5%
> 43-63                                           0.3%
> 53-73                                           0.4%
> 63-83                                           0.7%
> 83-103                                        0.8%
>
> Please help
>
>
> *mou_mean*
>
> *totalmrc_mean*
>
> *rev_range*
>
> *mou_range*
>
> *Churn*
>
> 23
>
> 24
>
> 25
>
> 27
>
> 1
>
> 45
>
> 46
>
> 47
>
> 49
>
> 1
>
> 43
>
> 44
>
> 45
>
> 47
>
> 1
>
> 45
>
> 46
>
> 47
>
> 49
>
> 0
>
> 56
>
> 57
>
> 58
>
> 60
>
> 0
>
> 67
>
> 68
>
> 69
>
> 71
>
> 1
>
> 67
>
> 68
>
> 69
>
> 71
>
> 0
>
> 44
>
> 45
>
> 46
>
> 48
>
> 1
>
> 33
>
> 34
>
> 35
>
> 37
>
> 0
>
> 90
>
> 91
>
> 92
>
> 94
>
> 1
>
> 87
>
> 88
>
> 89
>
> 91
>
> 1
>
> 76
>
> 77
>
> 78
>
> 80
>
> 1
>
> 33
>
> 34
>
> 35
>
> 37
>
> 1
>
> 44
>
> 45
>
> 46
>
> 48
>
> 1
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Multiple Histograms in R

Hasan Diwan-2
In reply to this post by prateek
Prateek,
I'm shocked this isn't answered previously, but you can try the par command
(mfrow and mfcol parameters) and par(mfrow=n, mfcol=m) will generate n
plots per row and m rows per column. For subsequent questions, please do a
search through the archives before asking. -- H

On 19 April 2017 at 06:05, prateek pande <[hidden email]> wrote:

> Hi,
>
> I have a data as mentioned below(at the bottom)
>
> Now out of that data i have to create multiple histograms in a single view
> in  R. On that histogram i need on x -axis binned data with Breaks 10 and
> on y axis event rate . Here churn is dependent variable.
>
>
> *for example, for mou_mean , on x -axis on histogram i need Bins(mou_mean)
> and on y - axis in need Churn%age. *
> *Bins(mou_mean)*
>
> *Churn %age*
> 23-43                                          0.23%
> 33-53                                          0.5%
> 43-63                                           0.3%
> 53-73                                           0.4%
> 63-83                                           0.7%
> 83-103                                        0.8%
>
> Please help
>
>
> *mou_mean*
>
> *totalmrc_mean*
>
> *rev_range*
>
> *mou_range*
>
> *Churn*
>
> 23
>
> 24
>
> 25
>
> 27
>
> 1
>
> 45
>
> 46
>
> 47
>
> 49
>
> 1
>
> 43
>
> 44
>
> 45
>
> 47
>
> 1
>
> 45
>
> 46
>
> 47
>
> 49
>
> 0
>
> 56
>
> 57
>
> 58
>
> 60
>
> 0
>
> 67
>
> 68
>
> 69
>
> 71
>
> 1
>
> 67
>
> 68
>
> 69
>
> 71
>
> 0
>
> 44
>
> 45
>
> 46
>
> 48
>
> 1
>
> 33
>
> 34
>
> 35
>
> 37
>
> 0
>
> 90
>
> 91
>
> 92
>
> 94
>
> 1
>
> 87
>
> 88
>
> 89
>
> 91
>
> 1
>
> 76
>
> 77
>
> 78
>
> 80
>
> 1
>
> 33
>
> 34
>
> 35
>
> 37
>
> 1
>
> 44
>
> 45
>
> 46
>
> 48
>
> 1
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>



--
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
http://bit.ly/hd1ScheduleRequest.
Si vous voudrais faire connnaisance, allez a
http://bit.ly/hd1ScheduleRequest.

<https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1>Sent
from my mobile device
Envoye de mon portable

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Multiple Histograms in R

prateek
HI Hasan,

Thanks for sharing the solution. Really appreciate it.

But i was reading somewhere that we cannot use par with ggplot 2 . we can
only use grid extra to have multiple plots in a single view.

Is it right?

Regards
Prateek

On Thu, Apr 20, 2017 at 10:47 AM, Hasan Diwan <[hidden email]> wrote:

> Prateek,
> I'm shocked this isn't answered previously, but you can try the par
> command (mfrow and mfcol parameters) and par(mfrow=n, mfcol=m) will
> generate n plots per row and m rows per column. For subsequent questions,
> please do a search through the archives before asking. -- H
>
> On 19 April 2017 at 06:05, prateek pande <[hidden email]> wrote:
>
>> Hi,
>>
>> I have a data as mentioned below(at the bottom)
>>
>> Now out of that data i have to create multiple histograms in a single view
>> in  R. On that histogram i need on x -axis binned data with Breaks 10 and
>> on y axis event rate . Here churn is dependent variable.
>>
>>
>> *for example, for mou_mean , on x -axis on histogram i need Bins(mou_mean)
>> and on y - axis in need Churn%age. *
>> *Bins(mou_mean)*
>>
>> *Churn %age*
>> 23-43                                          0.23%
>> 33-53                                          0.5%
>> 43-63                                           0.3%
>> 53-73                                           0.4%
>> 63-83                                           0.7%
>> 83-103                                        0.8%
>>
>> Please help
>>
>>
>> *mou_mean*
>>
>> *totalmrc_mean*
>>
>> *rev_range*
>>
>> *mou_range*
>>
>> *Churn*
>>
>> 23
>>
>> 24
>>
>> 25
>>
>> 27
>>
>> 1
>>
>> 45
>>
>> 46
>>
>> 47
>>
>> 49
>>
>> 1
>>
>> 43
>>
>> 44
>>
>> 45
>>
>> 47
>>
>> 1
>>
>> 45
>>
>> 46
>>
>> 47
>>
>> 49
>>
>> 0
>>
>> 56
>>
>> 57
>>
>> 58
>>
>> 60
>>
>> 0
>>
>> 67
>>
>> 68
>>
>> 69
>>
>> 71
>>
>> 1
>>
>> 67
>>
>> 68
>>
>> 69
>>
>> 71
>>
>> 0
>>
>> 44
>>
>> 45
>>
>> 46
>>
>> 48
>>
>> 1
>>
>> 33
>>
>> 34
>>
>> 35
>>
>> 37
>>
>> 0
>>
>> 90
>>
>> 91
>>
>> 92
>>
>> 94
>>
>> 1
>>
>> 87
>>
>> 88
>>
>> 89
>>
>> 91
>>
>> 1
>>
>> 76
>>
>> 77
>>
>> 78
>>
>> 80
>>
>> 1
>>
>> 33
>>
>> 34
>>
>> 35
>>
>> 37
>>
>> 1
>>
>> 44
>>
>> 45
>>
>> 46
>>
>> 48
>>
>> 1
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] 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/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> OpenPGP: https://sks-keyservers.net/pks/lookup?op=
> get&search=0xFEBAD7FFD041BBA1
> If you wish to request my time, please do so using http://bit.ly/
> hd1ScheduleRequest.
> Si vous voudrais faire connnaisance, allez a http://bit.ly/
> hd1ScheduleRequest.
>
> <https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1>Sent
> from my mobile device
> Envoye de mon portable
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Multiple Histograms in R

Ulrik Stervbo-2
Hi Prateek,

maybe facet_* with ggplot is what you are looking for

HTH
Ulrik

On Thu, 20 Apr 2017 at 13:24 prateek pande <[hidden email]> wrote:

> HI Hasan,
>
> Thanks for sharing the solution. Really appreciate it.
>
> But i was reading somewhere that we cannot use par with ggplot 2 . we can
> only use grid extra to have multiple plots in a single view.
>
> Is it right?
>
> Regards
> Prateek
>
> On Thu, Apr 20, 2017 at 10:47 AM, Hasan Diwan <[hidden email]>
> wrote:
>
> > Prateek,
> > I'm shocked this isn't answered previously, but you can try the par
> > command (mfrow and mfcol parameters) and par(mfrow=n, mfcol=m) will
> > generate n plots per row and m rows per column. For subsequent questions,
> > please do a search through the archives before asking. -- H
> >
> > On 19 April 2017 at 06:05, prateek pande <[hidden email]> wrote:
> >
> >> Hi,
> >>
> >> I have a data as mentioned below(at the bottom)
> >>
> >> Now out of that data i have to create multiple histograms in a single
> view
> >> in  R. On that histogram i need on x -axis binned data with Breaks 10
> and
> >> on y axis event rate . Here churn is dependent variable.
> >>
> >>
> >> *for example, for mou_mean , on x -axis on histogram i need
> Bins(mou_mean)
> >> and on y - axis in need Churn%age. *
> >> *Bins(mou_mean)*
> >>
> >> *Churn %age*
> >> 23-43                                          0.23%
> >> 33-53                                          0.5%
> >> 43-63                                           0.3%
> >> 53-73                                           0.4%
> >> 63-83                                           0.7%
> >> 83-103                                        0.8%
> >>
> >> Please help
> >>
> >>
> >> *mou_mean*
> >>
> >> *totalmrc_mean*
> >>
> >> *rev_range*
> >>
> >> *mou_range*
> >>
> >> *Churn*
> >>
> >> 23
> >>
> >> 24
> >>
> >> 25
> >>
> >> 27
> >>
> >> 1
> >>
> >> 45
> >>
> >> 46
> >>
> >> 47
> >>
> >> 49
> >>
> >> 1
> >>
> >> 43
> >>
> >> 44
> >>
> >> 45
> >>
> >> 47
> >>
> >> 1
> >>
> >> 45
> >>
> >> 46
> >>
> >> 47
> >>
> >> 49
> >>
> >> 0
> >>
> >> 56
> >>
> >> 57
> >>
> >> 58
> >>
> >> 60
> >>
> >> 0
> >>
> >> 67
> >>
> >> 68
> >>
> >> 69
> >>
> >> 71
> >>
> >> 1
> >>
> >> 67
> >>
> >> 68
> >>
> >> 69
> >>
> >> 71
> >>
> >> 0
> >>
> >> 44
> >>
> >> 45
> >>
> >> 46
> >>
> >> 48
> >>
> >> 1
> >>
> >> 33
> >>
> >> 34
> >>
> >> 35
> >>
> >> 37
> >>
> >> 0
> >>
> >> 90
> >>
> >> 91
> >>
> >> 92
> >>
> >> 94
> >>
> >> 1
> >>
> >> 87
> >>
> >> 88
> >>
> >> 89
> >>
> >> 91
> >>
> >> 1
> >>
> >> 76
> >>
> >> 77
> >>
> >> 78
> >>
> >> 80
> >>
> >> 1
> >>
> >> 33
> >>
> >> 34
> >>
> >> 35
> >>
> >> 37
> >>
> >> 1
> >>
> >> 44
> >>
> >> 45
> >>
> >> 46
> >>
> >> 48
> >>
> >> 1
> >>
> >>         [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> [hidden email] 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/posti
> >> ng-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
> >
> > --
> > OpenPGP: https://sks-keyservers.net/pks/lookup?op=
> > get&search=0xFEBAD7FFD041BBA1
> > If you wish to request my time, please do so using http://bit.ly/
> > hd1ScheduleRequest.
> > Si vous voudrais faire connnaisance, allez a http://bit.ly/
> > hd1ScheduleRequest.
> >
> > <https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
> >Sent
> > from my mobile device
> > Envoye de mon portable
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Multiple Histograms in R

Gerrit Draisma-2
In reply to this post by prateek
Prateek,
Does lattice do what you want?
HTH Gerrit

ppdat<-read.table(text="mou_mean,totalmrc_mean,rev_range,mou_range,Churn
23,24,25,27,1
45,46,47,49,1
43,44,45,47,1
45,46,47,49,0
56,57,58,60,0
67,68,69,71,1
67,68,69,71,0
44,45,46,48,1
33,34,35,37,0
90,91,92,94,1
87,88,89,91,1
76,77,78,80,1
33,34,35,37,1
44,45,46,48,1",
sep=",",header=TRUE)
library(lattice)
ppdat <- reshape(ppdat,times=names(ppdat)[1:4],
                 varying=list(names(ppdat)[1:4]),
                 direction="long",
                 timevar="Characteristic",
                 v.name="Value")
histogram(Churn~Value|Characteristic,nint=10,data=ppdat)


>  Message: 1
> Date: Thu, 20 Apr 2017 16:54:35 +0530
> From: prateek pande <[hidden email]>
> To: Hasan Diwan <[hidden email]>
> Cc: r-help mailing list <[hidden email]>
> Subject: Re: [R] Multiple Histograms in R
> Message-ID:
> <[hidden email]>
> Content-Type: text/plain; charset="UTF-8"
>
> HI Hasan,
>
> Thanks for sharing the solution. Really appreciate it.
>
> But i was reading somewhere that we cannot use par with ggplot 2 . we can
> only use grid extra to have multiple plots in a single view.
>
> Is it right?
>
> Regards
> Prateek
> Message: 2
> Date: Thu, 20 Apr 2017 12:26:47 +0000
> From: Ulrik Stervbo <[hidden email]>
> To: prateek pande <[hidden email]>, Hasan Diwan
> <[hidden email]>
> Cc: r-help mailing list <[hidden email]>
> Subject: Re: [R] Multiple Histograms in R
> Message-ID:
> <[hidden email]>
> Content-Type: text/plain; charset="UTF-8"
>
> Hi Prateek,
>
> maybe facet_* with ggplot is what you are looking for
>
> HTH
> Ulrik
>

______________________________________________
[hidden email] 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.