Re: [R] select rows with identical columns from a data frame

2013-01-20 Thread David Winsemius
On Jan 20, 2013, at 9:27 AM, David Winsemius wrote: On Jan 20, 2013, at 8:26 AM, Sam Steingold wrote: * Bert Gunter [2013-01-19 22:26:46 -0800]: But David W. and Bill Dunlap gave you solutions that also work and are much faster, no?! Yes, indeed, and I am now using David's solution as

Re: [R] select rows with identical columns from a data frame

2013-01-20 Thread David Winsemius
On Jan 20, 2013, at 8:26 AM, Sam Steingold wrote: * Bert Gunter [2013-01-19 22:26:46 -0800]: But David W. and Bill Dunlap gave you solutions that also work and are much faster, no?! Yes, indeed, and I am now using David's solution as it is fast (enough), simple and concise. I am a bit

Re: [R] select rows with identical columns from a data frame

2013-01-20 Thread Sam Steingold
> * Bert Gunter [2013-01-19 22:26:46 -0800]: > > But David W. and Bill Dunlap gave you solutions that also work and are > much faster, no?! Yes, indeed, and I am now using David's solution as it is fast (enough), simple and concise. Thanks a lot to David, Bill, Rui, and arun for their answers (t

Re: [R] select rows with identical columns from a data frame

2013-01-19 Thread Bert Gunter
But David W. and Bill Dunlap gave you solutions that also work and are much faster, no?! -- Bert On Sat, Jan 19, 2013 at 9:41 PM, Sam Steingold wrote: >> * Rui Barradas [2013-01-18 21:02:20 +]: >> >> Try the following. >> >> complete.cases(f) & apply(f, 1, function(x) all(x == x[1])) > > th

Re: [R] select rows with identical columns from a data frame

2013-01-19 Thread Sam Steingold
> * Rui Barradas [2013-01-18 21:02:20 +]: > > Try the following. > > complete.cases(f) & apply(f, 1, function(x) all(x == x[1])) thanks, this works, but is horribly slow (dim(f) is 766,950x2) -- Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000 http://www.chil

Re: [R] select rows with identical columns from a data frame

2013-01-18 Thread arun
 apply(f,1,function(x) all(duplicated(x)|duplicated(x,fromLast=TRUE)&!is.na(x))) #[1]  TRUE FALSE FALSE FALSE A.K. - Original Message - From: Sam Steingold To: r-help@r-project.org Cc: Sent: Friday, January 18, 2013 3:53 PM Subject: [R] select rows with identical columns fr

Re: [R] select rows with identical columns from a data frame

2013-01-18 Thread William Dunlap
1 1 1 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Sam Steingold > Sent: Friday, January 18, 2013 12:53 PM > To: r-help@r-project.org > Subjec

Re: [R] select rows with identical columns from a data frame

2013-01-18 Thread David Winsemius
On Jan 18, 2013, at 1:02 PM, Rui Barradas wrote: > Hello, > > Try the following. > > complete.cases(f) & apply(f, 1, function(x) all(x == x[1])) > > > Hope this helps, > > Rui Barradas > > Em 18-01-2013 20:53, Sam Steingold escreveu: >> I have a data frame with several columns. >> I want to

Re: [R] select rows with identical columns from a data frame

2013-01-18 Thread Rui Barradas
Hello, Try the following. complete.cases(f) & apply(f, 1, function(x) all(x == x[1])) Hope this helps, Rui Barradas Em 18-01-2013 20:53, Sam Steingold escreveu: I have a data frame with several columns. I want to select the rows with no NAs (as with complete.cases) and all columns identical

Re: [R] select rows with identical columns from a data frame

2013-01-18 Thread Sam Steingold
I can do Reduce("==",f[complete.cases(f),]) but that creates an intermediate data frame which I would love to avoid (to save memory). > * Sam Steingold [2013-01-18 15:53:21 -0500]: > > I have a data frame with several columns. > I want to select the rows with no NAs (as with complete.cases) > a

[R] select rows with identical columns from a data frame

2013-01-18 Thread Sam Steingold
I have a data frame with several columns. I want to select the rows with no NAs (as with complete.cases) and all columns identical. E.g., for --8<---cut here---start->8--- > f <- data.frame(a=c(1,NA,NA,4),b=c(1,NA,3,40),c=c(1,NA,5,40)) > f a b c 1 1 1 1