You are comparing B[1] to A[1]^2, then B[2] to A[2]^2 etc. so for the AB pairs you are doing the comparison. If that is what you want, then it is fine.
But if you want to compare the 1st B to all the A's, then the 2nd B to all the A's, etc. Then it does not do this (but the expand.grid function may help you. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Woo > Sent: Tuesday, February 08, 2011 3:57 AM > To: r-help@r-project.org > Subject: [R] please hep in uniform distribution > > > Hi > > I have generate two variable with uniform disrtribution A and B > > and I want to calculate the number of cases where B<A^2 > > So I done it by sum(B<A^2), but I'm not sure if there is anther way to > calculate the number of cases in the distribution or what I have done > is > fine > > > thanks for helping me > Woo > -- > View this message in context: http://r.789695.n4.nabble.com/please-hep- > in-uniform-distribution-tp3275719p3275719.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. ______________________________________________ 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.