[R] equivalent datatypes

Duncan Murdoch murdoch at stats.uwo.ca
Thu Mar 29 14:44:25 CEST 2007


On 3/29/2007 6:45 AM, Schmitt, Corinna wrote:
> Hallo,
> 
> can anyone help me with datatypes? Which datatypes from R are equivalent
> to the following ones from C?

I assume you mean functionally equivalent; if you mean equivalent in 
storage so you can pass them to C functions, see the Writing R 
Extensions manual.
> 
> C datatypes:
> 
> - double array

A numeric vector.

> - struct array

R has no exact equivalent.  A struct is similar to a list, but there is 
no enforcement of types in a list.  You could also implement a struct as 
an S4 object to get some type safety.  An array of structs would usually 
be done in R as a list of arrays, but could be done as a list of lists.

> - cell array

I don't know what a cell is in C.

> - char array

A single element character vector.

> - logical array

A logical vector.

Duncan Murdoch



More information about the R-help mailing list