[R] How to declare an array with columns storing different datatypes/precision

Duncan Murdoch murdoch at stats.uwo.ca
Wed Feb 4 15:05:46 CET 2009


On 2/4/2009 8:57 AM, Suresh_FSFM wrote:
> Dear R- Experts,
> Seek your help.
> 
> I want to creata data as follows.
> Ref_array with 4 columns.
> 1st column should store data of precision: 8.4 (i.e. 8 digits before decimal
> point and 4 digits after decimal points)
> 2nd column: should store data of type date "yyyy-mm-dd hh:mm:ss"
> 3rd column: only integer value. No decimal points
> 4th column: percentage values

In R, an array is all one data type, so you can't do that.  However, you 
can have a dataframe that comes close:  but there is no special type for 
  8.4 or percentage values, you'd need to use floating point (or fancy 
handling of integers) for those.

Duncan Murdoch




More information about the R-help mailing list