From dsamperi at DecisionSynergy.com  Tue Oct 25 13:43:09 2005
From: dsamperi at DecisionSynergy.com (Dominick Samperi)
Date: Tue, 25 Oct 2005 07:43:09 -0400
Subject: [Rd] Small issue with R's C API
Message-ID: <435E1A4D.102@DecisionSynergy.com>

Consider the R code:
mat <- matrix(seq(1,20),4,5)
is.matrix(mat) # gives TRUE
is.vector(mat) # gives FALSE

On the other hand, if mat is passed through the .Call interface the
corresponding SEXP (call it smat) satisfies
isMatrix(smat)   // TRUE
isVector(smat)  // TRUE

Consequently, you cannot distinguish matrices from vectors. Looking
at the dim attribute of a vector doesn't help because this is garbage.

Dominick



[Rd] Small issue with R's C API
Dominick Samperi