Dear list,

Does anyone know if there is a function that replaces a matrix of "NA"s in
an array with the previous matrix with numbers?  For example, I have an
array

ab <- array(dim=c(3,3,15),dimnames=list(rows=1:3,cols=1:3,dim=times)) .

Select out put from the array is:

, , dim = 0.478356969557745
    cols
rows         1 2         3
   1 0.4921053 0 0.5078947
   2 0.0000000 0 1.0000000
   3 0.0000000 0 1.0000000

, , dim = 0.525800177828904
    cols
rows  1  2  3
   1 NA NA NA
   2 NA NA NA
   3 NA NA NA

, , dim = 0.60831082579661
    cols
rows  1  2  3
   1 NA NA NA
   2 NA NA NA
   3 NA NA NA

I would like to replace the last two matrices in the array with the matrix
from a[,,dim = 0.478356969557745] so that the output looks like this:

, , dim = 0.478356969557745
    cols
rows         1 2         3
   1 0.4921053 0 0.5078947
   2 0.0000000 0 1.0000000
   3 0.0000000 0 1.0000000

, , dim = 0.525800177828904
     cols
rows         1 2         3
   1 0.4921053 0 0.5078947
   2 0.0000000 0 1.0000000
   3 0.0000000 0 1.0000000

, , dim = 0.60831082579661
    cols
rows         1 2         3
   1 0.4921053 0 0.5078947
   2 0.0000000 0 1.0000000
   3 0.0000000 0 1.0000000

Any help would be greatly appreciated!

Thanks!

Nicole

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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