x <- diag(2)
ifelse( x, x, 1-x)
ifelse( x, as.vector(x), 1-as.vector(x))
x <- diag.spam(2)
spam.options( structurebased=FALSE)
ifelse( x, as.vector(x), 1-as.vector(x))
spam.options( structurebased=TRUE)
ifelse( x, as.vector(x), 1-as.vector(x))
Run the code above in your browser using DataLab