ins.sort.c: Murray...

Usage Arguments Examples

View source: R/Scale.R

Usage

1
ins.sort.c(vec, sor.mat, sor.mat.sz, n)

Arguments

vec
sor.mat
sor.mat.sz
n

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (vec, sor.mat, sor.mat.sz, n) 
{
    r.min <- 1
    r.max <- sor.mat.sz
    tau <- vec[n]
    if (tau > sor.mat[r.max, n]) {
        r.min <- r.max <- sor.mat.sz + 1
    }
    else {
        while (r.max > r.min) {
            r.mid <- floor(0.5 * (r.max + r.min))
            if (tau <= sor.mat[r.mid, n]) {
                r.max <- r.mid
            }
            else {
                r.min <- r.mid + 1
            }
        }
    }
    return(rbind(sor.mat[seq_len(r.min - 1), , drop = FALSE], 
        vec, sor.mat[seq_len(sor.mat.sz - r.max + 1) + r.max - 
            1, , drop = FALSE]))
  }

mpoll/scale documentation built on Dec. 9, 2019, 7:15 a.m.