Hello!
 I will repeat my question :what is there in a numeric(0)?

 In a function, I have several matrices with dimensions 288x1, also matrices 
with dimensions  
 0x1 (numeric(0)).
 But I really do not know in which matrix there are elements or not.
 So, these matrices that do not contain anything, if I am saying this 
correctly, I would like to make them
 matrices with the same dimensions as the first ones but with NA elements and 
the ones with elements to remain as they 
 are.
 For this reason, I thought to use the ifelse command. But I have problems 
determining the arguments of this ifelse...
 I tried to use: 
 A1 <- ifelse(nrow(A)==0,matrix(rep(NA,288),288,1),A)

 If A is a matrix with elements, then I get a A1 matrix with replicated 288 
times its first element, but I want the  
 initial A matrix. If A is a matrix with no elements (numeric(0)) then I get 
only 1 NA.  
 
So, how can I test if there are elements in my matrix and if there are to 
return itself the matrix and if there are not to get a matrix 288x1 with NAs?
Thank you for your time!

Ismini

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to