data/USCounties.R

stopifnot(requireNamespace("Matrix" , quietly = TRUE)) # includes 'methods'

USCounties <-
    local({
	load(system.file(file.path("external", "USCounties_slots.rda"),
                         package = "Matrix"))
	## -> 'L'
	r <- methods::new("dsCMatrix")
        `slot<-` <- methods::`slot<-`
	for (n in c("Dim", "i","p","x"))
	    slot(r, n) <- L[[n]]
	r
    })

## The reverse:
if(FALSE) {
 L <- list()
 for (n in c("Dim", "i","p","x"))    L[[n]] <- slot(USCounties, n)
}

Try the Matrix package in your browser

Any scripts or data that you put into this service are public.

Matrix documentation built on Nov. 11, 2022, 9:06 a.m.