[R-sig-DB] data frame remove column
Prof Brian Ripley
r|p|ey @end|ng |rom @t@t@@ox@@c@uk
Sat Aug 25 08:14:52 CEST 2012
This is off-topic for this list. Please use R-help.
The list moderator.
On 25/08/2012 00:10, Kate Dresh wrote:
> *Hi all,*
>
>
>
> I'm trying to filter a file through the columns. This file below is a
> example of my data frame. My true data frame has seven hundred thousand
> columns and 500 hundred lines. I need to identify and to remove all columns
> that all elements equal a number 1. In this my case, columns were deleted
> are number 1,5 and 10.
>
>
>
>
>
> file <-read.table(text="
>
> 1 0 2 2 1 1 5 1 1 1
>
> 1 0 2 2 1 1 5 1 1 1
>
> 1 0 2 2 1 2 5 2 2 1
>
> 1 0 2 2 1 1 5 1 1 1
>
> 1 0 2 2 1 0 5 0 2 1
>
> 1 0 2 2 1 1 5 1 0 1
>
> ",sep="",header=FALSE)
>
>
>
> the result after the filter will be
>
>
>
> 0 2 2 1 5 1 1
>
> 0 2 2 1 5 1 1
>
> 0 2 2 2 5 2 2
>
> 0 2 2 1 5 1 1
>
> 0 2 2 0 5 0 2
>
> 0 2 2 1 5 1 0
>
>
>
> I used this commands idlength<-sapply(file,function(x) length(unique(x))
> ),
>
> but came an error message:
>
>
>
> caught segfault ***
>
> address 0x4, cause 'memory not mapped'
>
>
>
> *My question: is it possible to remove the all columns from above file
> to *achieve* the desired result?*
>
> * *
>
> * *
>
> *Thank you for help*
>
>
>
> Kate
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-DB mailing list -- R Special Interest Group
> R-sig-DB using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-db
>
--
Brian D. Ripley, ripley using stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-sig-DB
mailing list