search for: min_pos_v

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

Did you mean: min_pos_val
2010 Jul 15
2
replace negative numbers by smallest positive value in matrix
...9544, 1.31642572649823, 1.78842032090131, -0.991393884836917, -0.868946528068323, -0.325472385456867, 0.119383948888965), .Dim = c(5L, 4L)) # replacement of negative numbers for (mycol in 1:ncol(mymat)) { sort_dat <- sort(mymat[,mycol]) min_pos_index <- min(which(sort_dat >0 )) min_pos_val <- sort_dat[min_pos_index] neg_nums <- which(mymat[,mycol] <= 0) mymat[neg_nums,mycol] <- min_pos_val }