View source: R/is.num_complex.R
is.num_complex | R Documentation |
returns a boolean TRUE if the vector is a numeric OR complex vector.
is.num_complex(x)
x |
The item x must be a vector or a matrix. |
Function was introduced to take care of complex vectors and numeric vectors since mathematically a complex and numeric matrix would occupy the same space *C^m,n* space.
In comp. sci. parlancethey are diffrent.
Hence was introduced to ease the build up of mathematical functions.
The value returned is a SINGLE boolean value and NOT a boolean vector or matrix.
This is the case since you can't have a complex no., a numeric and a character in the same vector or matrix in R.
Hence only a single bit is returned indicating the type of vector or matrix being used.
Chitran Ghosal
library(StatsChitran) ##Call the library
M <- matrix(data = c(1, 2, 3+2i, 'a'), nrow=2, ncol=2, byrow=T)
is.num_complex(M)
M <- matrix(data = c(1, 2, 3+2i, 4), nrow=2, ncol=2, byrow=T)
is.num_complex(M)
M <- matrix(data = c(1, 2, 3, 4), nrow=2, ncol=2, byrow=T)
is.num_complex(M)
###The function is currently defined as
is.num_complex <- function(X){
return(is.numeric(X) | is.complex(X))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.