File: NaArray-subassignment.R

package info (click to toggle)
r-bioc-sparsearray 1.6.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,768 kB
  • sloc: ansic: 16,138; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 865 bytes parent folder | download
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
### =========================================================================
### NaArray subassignment
### -------------------------------------------------------------------------
###


.subassign_NaSVT_by_Lindex <- function(x, Lindex, value)
{
    x <- adjust_left_type(x, value)
    stopifnot(is.vector(Lindex), is.numeric(Lindex))

    ## No-op (except for type adjustment above) if selection is empty.
    if (length(Lindex) == 0L)
        return(x)

    value <- .normalize_right_value(value, type(x), length(Lindex))

    new_NaSVT <- SparseArray.Call("C_subassign_SVT_by_Lindex",
                                  x@dim, x@type, x@NaSVT, TRUE, Lindex, value)
    BiocGenerics:::replaceSlots(x, NaSVT=new_NaSVT, check=FALSE)
}

setMethod("subassign_Array_by_Lindex", "NaArray",
    function(x, Lindex, value) .subassign_NaSVT_by_Lindex(x, Lindex, value)
)