Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-02-01 Thread Dimitri Liakhovitski
n(x1$a)),] >> # item a b >> #3 s 1 41 >> x1[x1$a==which.min(x1$a[x1$a> # item a b >> #3 s 1 41 >> #11h 1 46 >> #17c 1 48 >> x1[x1$a==which.min(x1$a[x1$a> A.K. >> >> >> >>

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread Dimitri Liakhovitski
,] > # item a b > #3s 1 41 > x1[x1$a==which.min(x1$a[x1$a # item a b > #3 s 1 41 > #11h 1 46 > #17c 1 48 > x1[x1$a==which.min(x1$a[x1$a A.K. > > > ________________ > From: Dimitri Liakhovitski > To: arun > Cc: R help ; Jessica Strei

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread arun
me(item="f",a=3,b=10,stringsAsFactors=F) >> x[intersect(which(x$a < y$a),which.min(x$a)),] <- y >> >> x >>#   item  a  b >>#1 a  8 25 >>#2 a 10 26 >>#3     f  3 10 #replaced >>#4     e 15 26 >>#5 b 13 20 >>

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread Dimitri Liakhovitski
placed >> #4 e 15 26 >> #5 b 13 20 >> #6 a 5 23 >> #7 d 4 29 >> #8 e 2 24 >> #9 c 7 30 >> #10e 14 24 >> #11d 2 20 >> #12e 10 21 >> #13c 13 27 >> #14d 12 23 >> #15b 11 26 >>

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread Dimitri Liakhovitski
10 #replaced > #4 e 15 26 > #5 b 13 20 > #6 a 5 23 > #7 d 4 29 > #8 e 2 24 > #9 c 7 30 > #10e 14 24 > #11d 2 20 > #12e 10 21 > #13 c 13 27 > #14d 12 23 > #15 b 11 26 > #16 e 5 22 > #17c 1 2

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread arun
a==1]) #[1] 3404 x1[x1$a%in%which.min(x1[x1$a To: r-help Cc: Sent: Tuesday, January 29, 2013 4:11 PM Subject: [R] Fastest way to compare a single value with all values in one column of a data frame Hello! I have a large data frame x: x<-data.frame(item=letters[1:5],a=1:5,b=11:15)  # in actuali

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread arun
Hi, I guess you could also use:  x[match(min(x$a),x$a[x$a To: r-help Cc: Sent: Tuesday, January 29, 2013 4:11 PM Subject: [R] Fastest way to compare a single value with all values in one column of a data frame Hello! I have a large data frame x: x<-data.frame(item=letters[1:5],a=1:5,b=11

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread Jessica Streicher
If you wanted this for all values in x that are smaller, i'd use x[x$a < y$a,] <- y for just the smallest: x[intersect(which(x$a < y$a),which.min(x$a)),] <- y On 29.01.2013, at 22:11, Dimitri Liakhovitski wrote: > Hello! > > I have a large data frame x: > x<-data.frame(item=letters[1:5],a=1:

Re: [R] Fastest way to compare a single value with all values in one column of a data frame

2013-01-30 Thread nalluri pratap
y would be to refer "library(sqldf)". --- On Wed, 30/1/13, Dimitri Liakhovitski wrote: From: Dimitri Liakhovitski Subject: [R] Fastest way to compare a single value with all values in one column of a data frame To: "r-help" Date: Wednesday, 30 January, 2013, 2:41 AM He