The R Project SVN R

Rev

Rev 61433 | Rev 66444 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61433 Rev 61523
Line 62... Line 62...
62
  Note that a \code{\link{data.frame}} is \strong{not} a matrix by this
62
  Note that a \code{\link{data.frame}} is \strong{not} a matrix by this
63
  test.  The function is generic: you can write methods to handle
63
  test.  The function is generic: you can write methods to handle
64
  specific classes of objects, see \link{InternalMethods}.
64
  specific classes of objects, see \link{InternalMethods}.
65
 
65
 
66
  \code{as.matrix} is a generic function.  The method for data frames
66
  \code{as.matrix} is a generic function.  The method for data frames
67
  will return a character matrix if there is any
67
  will return a character matrix if there is only atomic columns and any
68
  non-(numeric/logical/complex) column, applying \code{\link{format}} to
68
  non-(numeric/logical/complex) column, applying \code{\link{as.vector}}
69
  non-character columns.  Otherwise, the usual coercion hierarchy
69
  to factors and \code{\link{format}} to other non-character columns.
70
  (logical < integer < double < complex) will be used, e.g., all-logical
70
  Otherwise, the usual coercion hierarchy (logical < integer < double <
71
  data frames will be coerced to a logical matrix, mixed logical-integer
71
  complex) will be used, e.g., all-logical data frames will be coerced
72
  will give a integer matrix, etc.
72
  to a logical matrix, mixed logical-integer will give a integer matrix,
-
 
73
  etc.
73
 
74
 
74
  The default method for \code{as.matrix} calls \code{as.vector(x)}, and
75
  The default method for \code{as.matrix} calls \code{as.vector(x)}, and
75
  hence e.g. coerces factors to character vectors.
76
  hence e.g. coerces factors to character vectors.
76
 
77
 
77
  When coercing a vector, it produces a one-column matrix, and
78
  When coercing a vector, it produces a one-column matrix, and