[R] Conditional plot

David Winsemius dwinsemius at comcast.net
Tue Feb 9 01:33:21 CET 2010


On Feb 8, 2010, at 7:01 PM, mnstn wrote:

>
> Hello All,
> I have the following data set:
>> all
>           [,1]      [,2]
> [1,] 297.04115 286.34645
> [2,] 303.94056 270.81590
> [3,] 297.87190 290.48009
> [4,] 305.81938 304.26238
> [5,] 294.92061  92.14025
> [6,]  72.09721 304.83084
> [7,]  66.53062 279.65700
> [8,] 218.46609 318.90179
> [9,] 306.55251 295.80110
> [10,] 278.48156 269.71947
> [11,] 201.24514 277.66272
> [12,] 303.93334 296.89303
> [13,] 295.89849  81.98786
> [14,]  46.82938  74.70764
>
> I would like to plot(all[,1],all[,2]) when all[,2]>200. The answer,  
> I am
> guessing, is embarrassingly simple but I simply cannot figure it  
> out. Please
> help me.

Logical indices on "x" and "y"

plot( all[ all[,2]>200, 1], all[ all[,2]>200, 2] )

I know this is tempting the Fates, untested, but too simple to be wrong.
>

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list