search for: neg_num

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

Did you mean: new_num
2010 Jul 15
2
replace negative numbers by smallest positive value in matrix
...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 }