Description Usage Arguments Value Examples
Densum
1 2 |
vin |
Parameter |
bw |
Parameter |
dw |
Parameter |
match.wt.f |
Parameter |
return.x |
Parameter |
from |
Parameter |
to |
Parameter |
step |
Parameter |
new.code |
Parameter |
Some sum
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ## Not run:
##---- 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 (vin, bw = 5, dw = 3, match.wt.f = NULL, return.x = T,
from = min(vin), to = max(vin), step = 1, new.code = T)
{
tc <- table(vin[vin >= from & vin <= to])
pos <- as.numeric(names(tc))
storage.mode(pos) <- "double"
tc <- as.numeric(tc)
storage.mode(tc) <- "double"
n <- length(pos)
if (!is.null(match.wt.f)) {
tc <- tc * match.wt.f(pos)
}
rng <- c(from, to)
if (rng[1] < 0) {
stop("range extends into negative values")
}
if (range(pos)[1] < 0) {
stop("position vector contains negative values")
}
storage.mode(n) <- storage.mode(rng) <- storage.mode(bw)
<- storage.mode(dw) <- storage.mode(step) <- "integer"
spos <- rng[1]
storage.mode(spos) <- "double"
dlength <- floor((rng[2] - rng[1])/step) + 1
if (dlength < 1) {
stop("zero data range")
}
if (new.code) {
storage.mode(step) <- storage.mode(dlength)
<- storage.mode(bw) <- storage.mode(dw) <- "integer"
dout <- .Call("ccdensum", pos, tc, spos, bw, dw, dlength,
step)
}
else {
dout <- numeric(dlength)
storage.mode(dout) <- "double"
storage.mode(dlength) <- "integer"
.C("cdensum", n, pos, tc, spos, bw, dw, dlength, step,
dout)
}
if (return.x) {
return(list(x = c(rng[1], rng[1] + step * (dlength -
1)), y = dout, step = step))
}
else {
return(dout)
}
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.