[R] Capping outliers

2011-11-22 Thread Aher
Hi Experts, I am new to R, using following sample code for capping outliers using percentile information. Working on large data (3 observations and 150 variables), loop I am using in the below mentioned code for detecting outliers and capping to upper /lower percentile value is taking much

Re: [R] Capping outliers

2011-11-22 Thread Jim Holtman
You can easily vectorize this code using pmin/pmax. Sent from my iPad On Nov 22, 2011, at 1:06, Aher ajit.a...@cedar-consulting.com wrote: Hi Experts, I am new to R, using following sample code for capping outliers using percentile information. Working on large data (3 observations

Re: [R] Capping outliers

2011-11-22 Thread jim holtman
Here is the solution using pmin/pmax for 10,000 rows. min_pctle_cut - 0.01 max_pctle_cut - 0.99 library(outliers) n - 1 x1 - runif(n) x2 - runif(n) x3 - x1 + x2 + runif(n)/10 x4 - x1 + x2 + x3 + runif(n)/10 x5 - factor(sample(c('a','b','c'),n,replace=TRUE)) x6 - factor(1*(x5=='a' |