這是許多 Arrow 物件都有的 $cast()
方法的包裝函式。在 dplyr
管道中使用比直接呼叫方法更方便。
引數
- x
Array
、Table
、Expression
或類似的 Arrow 資料物件。- to
要轉換成的 DataType;對於 Table 和 RecordBatch,應為 Schema。
- safe
logical: 僅在不遺失資料(截斷、溢位等)的情況下才允許類型轉換。預設值為
TRUE
。- ...
要設定的特定
CastOptions
另請參閱
data-type
,其中列出了可與 to
一起使用的 DataType。
Arrow C++ CastOptions 文件 # nolint,其中列出了支援的 CastOptions。
範例
if (FALSE) { # \dontrun{
mtcars %>%
arrow_table() %>%
mutate(cyl = cast(cyl, string()))
} # }