matrix - Matrices in R Programming -
i new r programming , have few questions regarding matrices in r. i have function returns matrix. want check if returned matrix empty or not. how check in r? if integer can check is.null(someinteger) . how check same in case of matrices? also, integer can initialized x <- null . if have want initialize matrix. initialize mat <- matrix() or there other way? mat can of size. thankyou. there question of meant "empty" here test if matrix m has 0 length: length(m) == 0 regarding initializing matrix initializes 0x0 matrix: m <- matrix(, 0, 0) and initalizes 1x1 matrix containing na: m <- matrix() and initializes nr nc matrix of na values: m <- matrix(, nr, nc) not clear whether of these useful. may want describe trying accomplish. why need initialize @ all?