[R] Excluding all teh columns from a data frame if the standard deviation of that column is zero(0).
Rui Barradas
ruipbarradas at sapo.pt
Tue Oct 16 12:35:25 CEST 2012
Hello,
You're calling your dataset 'data' and 'df' in the same instruction,
hence the error. (Even if you were to call it different names in
different instructions...)
Also, both 'data' and 'df' are really bad names for objects, they're
already are R functions. Name your dataset something else. And be
consistent in the use of that name.
Hope this helps,
Rui Barradas
Em 16-10-2012 09:08, siddu479 escreveu:
> Hi All,
>
> I have a data frame where nearly 10K columns of data, where most of them
> have standard deviation( of all rows) as zero.
> I want to exclude all the columns from the data frame and proceed to further
> processing.
>
> I tried like blow.
> *data <- read.csv("data.CSV", header=T)
>
> for(i in 2:ncol(data))
> if(sd(data[,i])==0){
> df[,i] <-NULL
> }
> *
> where I have the data columns from 2:ncol, but getting the error "Error in
> df[, i] <- NULL : object of type 'closure' is not subsettable"
>
> Can any one suggest the right method to accomplish this.
>
>
>
>
>
>
> -----
> Sidda
> Business Analyst Lead
> Applied Materials Inc.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Excluding-all-teh-columns-from-a-data-frame-if-the-standard-deviation-of-that-column-is-zero-0-tp4646310.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list