[R] Plot with Group # as pch

Peter Ehlers ehlers at ucalgary.ca
Tue Sep 14 00:22:40 CEST 2010


On 2010-09-13 16:11, Kevin Burnham wrote:
> The line I have now is this:
>
> plot(alldata$haa_Haa, pch=alldata$Subject.Group)
>
> This more or less gives me what I want, but instead of using the actual
> group number as the plotting point it converts it to the pch character
> corresponding to that number.  Is there a way that the above line could be
> modified so that it would use the group 3 itself, rather than the
> corresponding charecter?
>

Wrap your pch values in as.character().

   -Peter Ehlers

> thanks again,
> k
>
> On Mon, Sep 13, 2010 at 5:00 PM, David Winsemius<dwinsemius at comcast.net>wrote:
>
>>
>> On Sep 13, 2010, at 5:48 PM, Kevin Burnham wrote:
>>
>>   Hi All,
>>> I am trying to plot per cent correct scores (column name =PerCorr) for
>>> each
>>> of about 40 subjects.  I would like the character representing each score
>>> to
>>> be a number between 0 and 4 depending on the subject's group (from the
>>> column Subject.Group).
>>>
>>
>> You can use text(x,y,   labels=    ) for the plotting ... once you have a
>> working example that is.
>>
>>
>>   Also, I would ideally be able to order the data by Subject.Group first so
>>> that all of group 0 is to the far left of the graph and all of group 4 to
>>> the far right.
>>> Thanks,
>>> Kevin
>>>
>>
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>



More information about the R-help mailing list