Hi For a school project I have a file with 120 columns and ~2000 lines. This file contains timestamps of spike detected in 60 channels, and the time elapsed between the last spike. I need to clean too high values. About 98% of values are between 0 and 2000 and 2% are between 2000 and 20'000. I want to get rid of theses values. Please could you help me? Regards Thom -- View this message in context: http://www.nabble.com/Need-to-clean-a-table%2C-and-compute-mean-and-SD-tp23364460p23364460.html Sent from the R help mailing list archive at Nabble.com.
Hi r-help-bounces at r-project.org napsal dne 04.05.2009 09:53:19:> > Hi > > For a school project I have a file with 120 columns and ~2000 lines.This> file contains timestamps of spike detected in 60 channels, and the time > elapsed between the last spike. > > I need to clean too high values. About 98% of values are between 0 and2000> and 2% are between 2000 and 20'000. I want to get rid of theses values. > > Please could you help me?Decide your threshold value. Let say it is 2000. Then it depends how do you want to get rid of the data. e.g. mat[mat>2000]<-NA shall put NA values instead all items which were bigger than 2000. Regards Petr> > Regards > > Thom > -- > View this message in context:http://www.nabble.com/Need-to-clean-a-table%2C-> and-compute-mean-and-SD-tp23364460p23364460.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 guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
Thom_249 wrote:> Hi > > For a school project I have a file with 120 columns and ~2000 lines. This > file contains timestamps of spike detected in 60 channels, and the time > elapsed between the last spike. > > I need to clean too high values. About 98% of values are between 0 and 2000 > and 2% are between 2000 and 20'000. I want to get rid of theses values. > > Please could you help me? > > Regards > > Thom >Hi, If you are dealing with a data frame, you can simply use the index function like this, my.data.frame[my.data.frame>2000] = NA This way, all values in your data.frame that are greater than 2000 will be transformed into NAs. However, this kind of substitution wouldn't be recommended if your goal is to fit a regression model to the data. Missing data can sometimes be informative, hence the importance to be careful when doing such substitutions. -- *Luc Villandr?*