one way is the following:
X1 <- c(1:10)
X2 <- c(11:20)
X3 <- c(21:30)
X4 <- c(31:40)
X5 <- c(41:50)
DF <- data.frame(X1, X2, X3, X4, X5)
as.data.frame(sapply(DF, function (x) {
qx <- quantile(x)
cut(x, qx, include.lowest = TRUE,
labels = 1:4)
}))
You may also have a look at fun
Dear R-Experts
I am sure this might look simple question for experts, at least is problem
for me. I have a large data frame with over 1000 variables and each have
different distribution( i.e. have different quantile). I want to create a
new grouped data frame, where the new variables where the val
2 matches
Mail list logo