[R] categorical vs numerical

Peter Ehlers ehlers at ucalgary.ca
Sat Dec 5 12:53:09 CET 2009


Whoops, that should be

  densityplot(~y|g, data=dat, plot.points=FALSE, layout=c(1,4))

  -Peter Ehlers

Peter Ehlers wrote:
> You could try density plots:
> If dat is your dataframe, y is your numerical vector and
> g is your factor,
> 
> library(lattice)
> trellis.device(height=9, width=7)
> densityplot(~g|y, data=dat, plot.points=FALSE, layout=c(1,4))
> 
> See ?densityplot, ?panel.densityplot
> 
>  -Peter Ehlers
> 
> DispersionMap wrote:
>> Thanks, however the group sizes are really big (each a,b,c.. category has
>> 60,000 observations). Its hard to see whats going on withe the jittered
>> stripchart, i just get big black blobs.
>>
>> Any other suggestions?
>>
>>
>>
>>
>> Peter Ehlers wrote:
>>> If your group sizes are not too large, I would use jittered stripcharts.
>>> They're more informative than boxplots and much less subject to
>>> misinterpretation. One warning, I'm not fond of the default pch=0.
>>>
>>>  -Peter Ehlers
>>>
>>> DispersionMap wrote:
>>>> What ways are there to plot categorical vs numerical data in R.
>>>>
>>>>
>>>> I have two columns: one with categorical data in 5 categories 
>>>> a,b,c,d,e,
>>>> and
>>>> a numerical column with integers between 1 and 100.
>>>>
>>>> I have used a boxplot with a,b,c,d,e on the x-axis and an increasing
>>>> numerical scale on the y-axis. This look fine but im looking for other
>>>> ways
>>>> to present the data.
>>>>
>>>>
>>>> What other ways can i do this???
>>>>
>>> ______________________________________________
>>> 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.
>>>
>>>
>>
> 
> ______________________________________________
> 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.
> 
> 

-- 
Peter Ehlers
University of Calgary
403.202.3936




More information about the R-help mailing list