Skip to content

Need to clean a table, and compute mean and SD

3 messages · Thom_249, PIKAL Petr, Luc Villandre

#
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

r-help-bounces at r-project.org napsal dne 04.05.2009 09:53:19:
This
2000
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
http://www.nabble.com/Need-to-clean-a-table%2C-
http://www.R-project.org/posting-guide.html
#
Thom_249 wrote:
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.