File: cast.Rd

package info (click to toggle)
apache-arrow 23.0.1-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 76,220 kB
  • sloc: cpp: 654,608; python: 70,522; ruby: 45,964; ansic: 18,742; sh: 7,365; makefile: 669; javascript: 125; xml: 41
file content (40 lines) | stat: -rw-r--r-- 1,211 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dplyr-funcs-type.R
\name{cast}
\alias{cast}
\title{Change the type of an array or column}
\usage{
cast(x, to, safe = TRUE, ...)
}
\arguments{
\item{x}{an \code{Array}, \code{Table}, \code{Expression}, or similar Arrow data object.}

\item{to}{\link{DataType} to cast to; for \link{Table} and \link{RecordBatch},
it should be a \link{Schema}.}

\item{safe}{logical: only allow the type conversion if no data is lost
(truncation, overflow, etc.). Default is \code{TRUE}.}

\item{...}{specific \code{CastOptions} to set}
}
\value{
An \link{Expression}
}
\description{
This is a wrapper around the \verb{$cast()} method that many Arrow objects have.
It is more convenient to call inside \code{dplyr} pipelines than the method.
}
\examples{
\dontrun{
mtcars |>
  arrow_table() |>
  mutate(cyl = cast(cyl, string()))
}
}
\seealso{
\code{\link{data-type}} for a list of \link{DataType} to be used with \code{to}.

\href{https://arrow.apache.org/docs/cpp/api/compute.html?highlight=castoptions#arrow\%3A\%3Acompute\%3A\%3ACastOptions}{Arrow C++ CastOptions documentation} # nolint
for the list of supported CastOptions.
}
\keyword{internal}