Re: [R] I bet apply has a solution

2012-02-06 Thread Petr PIKAL
Hi as.logical(rowSums(apply(Data, 2, diff)>0)) here is another option. Regards Petr > > Hi all > For the data below, I would like to return a logical value indicating > differences in the data. > > #Create data > Data..<-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2)) > >a b

Re: [R] I bet apply has a solution

2012-02-06 Thread Rolf Turner
No. This does not do anything like what the OP wanted. Did you ***try*** it, for crying out loud? cheers, Rolf Turner On 07/02/12 08:29, ilai wrote: duplicated(Data..) On Mon, Feb 6, 2012 at 11:34 AM, LCOG1 wrote: Hi all For the data below, I would like to return a logical val

Re: [R] I bet apply has a solution

2012-02-06 Thread ROLL Josh F
Ah. That's the one. Thank you. -Original Message- From: Ista Zahn [mailto:istaz...@gmail.com] Sent: Monday, February 06, 2012 11:12 AM To: ROLL Josh F Cc: r-help@r-project.org Subject: Re: [R] I bet apply has a solution Hi Josh, How about apply(Data, 1, function(row) sd(row)

Re: [R] I bet apply has a solution

2012-02-06 Thread ilai
duplicated(Data..) On Mon, Feb 6, 2012 at 11:34 AM, LCOG1 wrote: > Hi all > For the data below, I would like to return a logical value indicating > differences in the data. > > #Create data > Data..<-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2)) > >   a b c > 1  1 1 1 > 2  1 1 1 > 3  

Re: [R] I bet apply has a solution

2012-02-06 Thread Ista Zahn
Hi Josh, How about apply(Data, 1, function(row) sd(row) == 0) ? Best, Ista On Mon, Feb 6, 2012 at 1:34 PM, LCOG1 wrote: > Hi all > For the data below, I would like to return a logical value indicating > differences in the data. > > #Create data > Data..<-data.frame(a=rep(1,10),b=c(rep(1,9),

Re: [R] I bet apply has a solution

2012-02-06 Thread Justin Haynes
How bout: apply(Data..,1, function(vec) !all(vec==vec[1])) [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE On Mon, Feb 6, 2012 at 10:34 AM, LCOG1 wrote: > Hi all > For the data below, I would like to return a logical value indicating > differences in the data. > > #Create da

[R] I bet apply has a solution

2012-02-06 Thread LCOG1
Hi all For the data below, I would like to return a logical value indicating differences in the data. #Create data Data..<-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2)) a b c 1 1 1 1 2 1 1 1 3 1 1 1 4 1 1 1 5 1 1 1 6 1 1 1 7 1 1 1 8 1 1 1 9 1 1 2 10 1 2 2 So what I want