[Rd] several bugs (PR#918) lists and matrices

Rich Heiberger rmh@surfer.sbm.temple.edu
Mon, 23 Apr 2001 15:35:41 -0400 (EDT)


Robert's example
  x<-matrix(1:6,nc=3)
  x[[2,3]]<-NA
  attr(x[[2,3]],"mv") <- "absent"
loses the attribute in S-Plus as well as in R.  The only way I
have been able to put attributes on individual elements is to make
a matrix of lists.  Interestingly, this statement does print
  print(attr(x[[2,3]],"mv") <- "absent")
The value of the attribute doesn't vanish for the duration of the
current statement.  The value is gone if we follow this with
  attr(x[[2,3]],"mv")
Should there be a warning message when the assignment is attempted?

As to the fundamental question of putting dimensions on a list, that
is asking the question backwards from how I am looking at it.  I have
a two-dimensional array of data items for which one or more of the
values is unknown.  The matrix is the natural structure for this data.

How do I record the type of missingness for the missing datum?  I have
chosen to place a list in the cell of the matrix.  Another option is
to have a parallel matrix of missingness information, possibly
attached as an attribute to the original data.  Another option is a
sparse array of some form that is pointed to by access functions that
are sensitive to the NA in the original data matrix.

To me, the recursive structure is the most natural way to represent the
information about missingness.

Rich
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._