[R] multiple histograms from a dataframe

ilai keren at math.montana.edu
Sun Feb 12 18:37:07 CET 2012


On Sat, Feb 11, 2012 at 9:10 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Feb 11, 2012, at 6:25 PM, Adel ESSAFI wrote:
>
>>
>>
>> Le 11 février 2012 02:33, David Winsemius <dwinsemius at comcast.net> a écrit
>> :
>>
>> On Feb 10, 2012, at 7:05 PM, Adel ESSAFI wrote:
>>
>>
>> what can I do to draw to figures together using lattice?
>
>
> You need to describe what you mean by "together". It is possible that the
> goup parameter is what you want but that's just a guess. It's also possible
> that the formular operator "+" will give you what you desire. Perhaps:
>
> xyplot( law[,67] + law[,66] ~ law[,3]|
> interaction(law[,1],law[,2]),type='l')
>
>
>>
>> it draws multiple histograms but by selecting distinct values of  law[,1]
>> The deal is to make the same thing but for a couple of columns
>
>
> That doesn't make any sense to me. But then I do apologize for the English
> language. It's horribly complex and syntactically a mess.
>

English language aside, do you want histograms (count frequency) or
scatterplots (y~x) ? as David suggested the group argument or '+'
combined with allow.multiple is useful, but not trivial for
histograms. A simple solution is to consider alternatives such density
curves:

densityplot(~as.numeric(volcano[,c(2:5)])|cut(volcano[,1],4),
groups=gl(4,nrow(volcano)),
key=simpleKey(as.character(2:5),points=F,lines=T,columns=4))

In the future, a minimal working example and clear statement of your
goal may reduce the need for multiple posts.

Regards

>
>>
>> Thanks in advance for help
>>
>> Adel
>>
>>
>> --
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>> --
>> PhD candidate in Computer Science
>> Address
>> 3 avenue lamine, cité ezzahra, Sousse 4000
>> Tunisia
>> tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
>> fax: +216 71 391 166
>
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> 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