R
Previous Topic  Next Topic 

R is a free, open-source environment for statistical computing and graphics.  Stat/Transfer will read and write workspace files for R versions 2 and 3.


Standard extension:  rdata


Reading R files

The R file format is very unstructured and allows the user to write almost anything  into it. Therefore Stat/Transfer imposes a few restrictions on input files.  Specifically, your data file should contain at least one of the following kinds of objects.


      two dimensional matrices

      vectors

      factors

      dataframes


Stat/Transfer can read R files in either binary or the more common ASCII format.  Compressed files are recognized, but not supported.  You should decompress these first with another program such as gzip or Winzip.


Writing R files

On output, Stat/Transfer writes an R dataframe.  If your input data set does not have a variable named 'rownames', Stat/Transfer will create an extra variable containing the case number, stored as an integer variable and named 'rownames'.


Factors in R consist of a vector of zero-based numeric values and a vector of string labels that are mapped onto the values.  You can choose to have these written to an output file as the numeric values and their value labels or you can write them as strings.  This option is controlled in the R and S-Plus Options section of the Options dialog box.   If you are going to a package such a Stata or SPSS, that supports value labels, the first option is more appropriate.


Stat/Transfer writes R data in ASCII format, which is compatible across platforms.


Missing Data

R supports missing values.  On input, missing values are converted to the internal missing value in Stat/Transfer.  On output, missing values are converted to the value appropriate for each variable type.


If you are using Version One of R, check the Write version one string missing option in the R and S-Plus Options section of the Options dialog box and the appropriate value will be written for null or missing strings. If you are using a later version of R, leave this unchecked


Output Variable Types

The output variable type that results from each target variable type is given in the following table:




Target Type

Output Type


byte

int

long

Integer


float

Real


double

Double


string

String


date

Date


time

date/time

POSIX timestamp (note the time zone is not set, so the time will be in GMT)