[R-sig-DB] data frame remove column
Kate Dresh
dre@hk@te @end|ng |rom gm@||@com
Sat Aug 25 01:10:28 CEST 2012
*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]]
More information about the R-sig-DB
mailing list