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. Thanks. -- View this message in context: http://n4.nabble.com/Conditional-plot-tp1473754p1473754.html Sent from the R help mailing list archive at Nabble.com.
Hi: Since you didn't provide your data in a readable form for others, we had to resort to other methods: x <- rnorm(100, 180, 20) y <- rnorm(100, 190, 15) df <- data.frame(x = x, y = y) plot(y ~ x, data = df, subset = y > 200) My plot has y values strictly above 200. Is that what you wanted? HTH, Dennis On Mon, Feb 8, 2010 at 4:01 PM, mnstn <pavan.namd@gmail.com> 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. > Thanks. > -- > View this message in context: > http://n4.nabble.com/Conditional-plot-tp1473754p1473754.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]
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
Thanks Dennis and David, That is precisely what I was looking for. I will remember to post the data in a readable format in future. Cheers! -- View this message in context: http://n4.nabble.com/Conditional-plot-tp1473754p1473834.html Sent from the R help mailing list archive at Nabble.com.