I have a problem, I want to create a new column that returns the first position where the number exceeds the column. How can I do it?
A B C D E Mean Pos
2 5 4 4 5 4 2
3 4 5 6 7 5 4
9 8 7 6 5 7 1
#risultati <- vector()
bjibl <- function (x){
for (i in 1:3){
for (j in 1:3600){
if (x[i,j]>x[i, 3601]) {
#risultati <- append(i, j, after = i)
#risultati[i] <- j
x1 <- as.data.frame(x[,1:j])
x$risultati <- ncol(x1)
i <- i +1
j <- 1
}else{
j<-j+1
}
}
i <- i +1
}
}
bjibl(db_class)