search for: qntfun

Displaying 1 result from an estimated 1 matches for "qntfun".

2011 Mar 13
1
replace with quantile value for a large data frame...
...st to workout. # my example: X1 <- c(1:10) > X2 <- c(11:20) > X3 <- c(21:30) > X4 <- c(31:40) > X5 <- c(41:50) > dataf <- data.frame(X1, X2, X3, X4, X5) > > # my efforts of the last week led me to this point > for (i along(length(dataf[1,]))) { > qntfun <- function (x) { > XQ <- as.numeric(as.matrix(quantile(x))) > Q1 <- XQ[1] > Q2 <- XQ[2] > Q3 <- XQ[3] > Q4 <- XQ[4] > for (i in 1:length(x)){ > if (x[i] < Q2) { > x[i] <- 1 > } else { > if...