DataTypes (RPolarsDataType)
Description
DataType
any polars type (ported so far)
Value
not applicable
Examples
#> [1] "Array" "Binary" "Boolean" "Categorical" "Date"
#> [6] "Datetime" "Duration" "Enum" "Float32" "Float64"
#> [11] "Int16" "Int32" "Int64" "Int8" "List"
#> [16] "Null" "String" "Struct" "Time" "UInt16"
#> [21] "UInt32" "UInt64" "UInt8" "Unknown" "Utf8"
#> DataType: Float64
#> DataType: String
#> DataType: List(
#> List(
#> UInt64,
#> ),
#> )
#> DataType: Struct(
#> [
#> Field {
#> name: "CityNames",
#> dtype: String,
#> },
#> ],
#> )
# The function changes type from Int32 to String
# Specifying the output DataType: String solves the problem
as_polars_series(1:4)$map_elements(\(x) letters[x], datatype = pl$dtypes$String)
#> polars Series: shape: (4,)
#> Series: '_apply' [str]
#> [
#> "a"
#> "b"
#> "c"
#> "d"
#> ]