# Data Type Mapping

When you use TERR or open-source R expression functions or data functions in Spotfire, you must know how the supported data types are mapped between TERR (or open-source R) and Spotfire.

Spotfire data types | TERR or open-source R data types
--- | ---
Binary | `raw`
Boolean | `logical`
Currency | `numeric`
Date | `POSIXct` or `POSIXlt` with time zone UTC
DateTime | `POSIXct` or `POSIXlt` with time zone UTC
Integer | `integer`
LongInteger | `numeric`
Real | `numeric`
SingleReal | `numeric`
String | `character` (encoded as UTF-8)
Time | `POSIXct` or `POSIXlt` with zone UTC giving time on date 1/1/1970
TimeSpan | difftime

- All numeric invalid values in Spotfire are represented as NAs in TERR and open-source R engines. There is no special support for invalid values of other types. They become valid default values in TERR and open-source R engines.
- Spotfire converts TERR or open-source R factors to the data type String.
- Do not use the data type `date` when you use TERR or open-source R with Spotfire data types Date, DateTime, and Time. Spotfire converts the TERR data type `date` to the data type Real.
- Other data types than the ones included in this topic are not supported.

Note: Open-source R is available under separate open source software license terms and is not part of Spotfire Statistics Services. As such, open-source R is not within the scope of your license for Spotfire Statistics Services. Open-source R is not supported, maintained, or warranted in any way by Cloud Software Group, Inc. Download and use of open-source R is solely at your own discretion and subject to the free open source license terms applicable to open-source R.