blob: 4aa5787bfeac17f292104dc7f0b99af1b32918a3 [file] [log] [blame]
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Interface to the nanoarrow C Library • nanoarrow</title>
<script src="deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet">
<script src="deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet">
<link href="deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet">
<script src="deps/headroom-0.11.0/headroom.min.js"></script><script src="deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="deps/search-1.0.0/fuse.min.js"></script><script src="deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="pkgdown.js"></script><meta property="og:title" content="Interface to the nanoarrow C Library">
<meta name="description" content="Provides an R interface to the nanoarrow C library and the Apache Arrow application binary interface. Functions to import and export ArrowArray, ArrowSchema, and ArrowArrayStream C structures to and from R objects are provided alongside helpers to facilitate zero-copy data transfer among R bindings to libraries implementing the Arrow C data interface.">
<meta property="og:description" content="Provides an R interface to the nanoarrow C library and the Apache Arrow application binary interface. Functions to import and export ArrowArray, ArrowSchema, and ArrowArrayStream C structures to and from R objects are provided alongside helpers to facilitate zero-copy data transfer among R bindings to libraries implementing the Arrow C data interface.">
</head>
<body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">
<a class="navbar-brand me-2" href="index.html">nanoarrow</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">0.5.0.9000</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto">
<li class="nav-item"><a class="nav-link" href="reference/index.html">Reference</a></li>
<li class="nav-item"><a class="nav-link" href="news/index.html">Changelog</a></li>
</ul>
<ul class="navbar-nav">
<li class="nav-item"><form class="form-inline" role="search">
<input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="search.json">
</form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/apache/arrow-nanoarrow/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
</ul>
</div>
</div>
</nav><div class="container template-home">
<div class="row">
<main id="main" class="col-md-9"><div class="section level1">
<div class="page-header"><h1 id="nanoarrow">nanoarrow<a class="anchor" aria-label="anchor" href="#nanoarrow"></a>
</h1></div>
<!-- badges: start -->
<!-- badges: end -->
<p>The goal of nanoarrow is to provide minimal useful bindings to the <a href="https://arrow.apache.org/docs/format/CDataInterface.html" class="external-link">Arrow C Data</a> and <a href="https://arrow.apache.org/docs/format/CStreamInterface.html" class="external-link">Arrow C Stream</a> interfaces using the <a href="https://arrow.apache.org/nanoarrow/" class="external-link">nanoarrow C library</a>.</p>
<div class="section level2">
<h2 id="installation">Installation<a class="anchor" aria-label="anchor" href="#installation"></a>
</h2>
<p>You can install the released version of nanoarrow from <a href="https://cran.r-project.org/" class="external-link">CRAN</a> with:</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"nanoarrow"</span><span class="op">)</span></span></code></pre></div>
<p>You can install the development version of nanoarrow from <a href="https://github.com/" class="external-link">GitHub</a> with:</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># install.packages("remotes")</span></span>
<span><span class="fu">remotes</span><span class="fu">::</span><span class="fu">install_github</span><span class="op">(</span><span class="st">"apache/arrow-nanoarrow/r"</span><span class="op">)</span></span></code></pre></div>
<p>If you can load the package, you’re good to go!</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://arrow.apache.org/nanoarrow/latest/r/" class="external-link">nanoarrow</a></span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="example">Example<a class="anchor" aria-label="anchor" href="#example"></a>
</h2>
<p>The Arrow C Data and Arrow C Stream interfaces are comprised of three structures: the <code>ArrowSchema</code> which represents a data type of an array, the <code>ArrowArray</code> which represents the values of an array, and an <code>ArrowArrayStream</code>, which represents zero or more <code>ArrowArray</code>s with a common <code>ArrowSchema</code>. All three can be wrapped by R objects using the nanoarrow R package.</p>
<div class="section level3">
<h3 id="schemas">Schemas<a class="anchor" aria-label="anchor" href="#schemas"></a>
</h3>
<p>Use <code><a href="reference/as_nanoarrow_schema.html">infer_nanoarrow_schema()</a></code> to get the ArrowSchema object that corresponds to a given R vector type; use <code><a href="reference/as_nanoarrow_schema.html">as_nanoarrow_schema()</a></code> to convert an object from some other data type representation (e.g., an arrow R package <code>DataType</code> like <code><a href="https://arrow.apache.org/docs/r/reference/data-type.html" class="external-link">arrow::int32()</a></code>); or use <code>na_XXX()</code> functions to construct them.</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="reference/as_nanoarrow_schema.html">infer_nanoarrow_schema</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">5</span><span class="op">)</span></span>
<span><span class="co">#&gt; &lt;nanoarrow_schema int32&gt;</span></span>
<span><span class="co">#&gt; $ format : chr "i"</span></span>
<span><span class="co">#&gt; $ name : chr ""</span></span>
<span><span class="co">#&gt; $ metadata : list()</span></span>
<span><span class="co">#&gt; $ flags : int 2</span></span>
<span><span class="co">#&gt; $ children : list()</span></span>
<span><span class="co">#&gt; $ dictionary: NULL</span></span>
<span><span class="fu"><a href="reference/as_nanoarrow_schema.html">as_nanoarrow_schema</a></span><span class="op">(</span><span class="fu">arrow</span><span class="fu">::</span><span class="fu"><a href="https://arrow.apache.org/docs/r/reference/schema.html" class="external-link">schema</a></span><span class="op">(</span>col1 <span class="op">=</span> <span class="fu">arrow</span><span class="fu">::</span><span class="fu"><a href="https://arrow.apache.org/docs/r/reference/data-type.html" class="external-link">float64</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="co">#&gt; &lt;nanoarrow_schema struct&gt;</span></span>
<span><span class="co">#&gt; $ format : chr "+s"</span></span>
<span><span class="co">#&gt; $ name : chr ""</span></span>
<span><span class="co">#&gt; $ metadata : list()</span></span>
<span><span class="co">#&gt; $ flags : int 0</span></span>
<span><span class="co">#&gt; $ children :List of 1</span></span>
<span><span class="co">#&gt; ..$ col1:&lt;nanoarrow_schema double&gt;</span></span>
<span><span class="co">#&gt; .. ..$ format : chr "g"</span></span>
<span><span class="co">#&gt; .. ..$ name : chr "col1"</span></span>
<span><span class="co">#&gt; .. ..$ metadata : list()</span></span>
<span><span class="co">#&gt; .. ..$ flags : int 2</span></span>
<span><span class="co">#&gt; .. ..$ children : list()</span></span>
<span><span class="co">#&gt; .. ..$ dictionary: NULL</span></span>
<span><span class="co">#&gt; $ dictionary: NULL</span></span>
<span><span class="fu"><a href="reference/na_type.html">na_int64</a></span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co">#&gt; &lt;nanoarrow_schema int64&gt;</span></span>
<span><span class="co">#&gt; $ format : chr "l"</span></span>
<span><span class="co">#&gt; $ name : chr ""</span></span>
<span><span class="co">#&gt; $ metadata : list()</span></span>
<span><span class="co">#&gt; $ flags : int 2</span></span>
<span><span class="co">#&gt; $ children : list()</span></span>
<span><span class="co">#&gt; $ dictionary: NULL</span></span></code></pre></div>
</div>
<div class="section level3">
<h3 id="arrays">Arrays<a class="anchor" aria-label="anchor" href="#arrays"></a>
</h3>
<p>Use <code><a href="reference/as_nanoarrow_array.html">as_nanoarrow_array()</a></code> to convert an object to an ArrowArray object:</p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="reference/as_nanoarrow_array.html">as_nanoarrow_array</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">5</span><span class="op">)</span></span>
<span><span class="co">#&gt; &lt;nanoarrow_array int32[5]&gt;</span></span>
<span><span class="co">#&gt; $ length : int 5</span></span>
<span><span class="co">#&gt; $ null_count: int 0</span></span>
<span><span class="co">#&gt; $ offset : int 0</span></span>
<span><span class="co">#&gt; $ buffers :List of 2</span></span>
<span><span class="co">#&gt; ..$ :&lt;nanoarrow_buffer validity&lt;bool&gt;[0][0 b]&gt; ``</span></span>
<span><span class="co">#&gt; ..$ :&lt;nanoarrow_buffer data&lt;int32&gt;[5][20 b]&gt; `1 2 3 4 5`</span></span>
<span><span class="co">#&gt; $ dictionary: NULL</span></span>
<span><span class="co">#&gt; $ children : list()</span></span>
<span><span class="fu"><a href="reference/as_nanoarrow_array.html">as_nanoarrow_array</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>col1 <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1.1</span>, <span class="fl">2.2</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="co">#&gt; &lt;nanoarrow_array struct[2]&gt;</span></span>
<span><span class="co">#&gt; $ length : int 2</span></span>
<span><span class="co">#&gt; $ null_count: int 0</span></span>
<span><span class="co">#&gt; $ offset : int 0</span></span>
<span><span class="co">#&gt; $ buffers :List of 1</span></span>
<span><span class="co">#&gt; ..$ :&lt;nanoarrow_buffer validity&lt;bool&gt;[0][0 b]&gt; ``</span></span>
<span><span class="co">#&gt; $ children :List of 1</span></span>
<span><span class="co">#&gt; ..$ col1:&lt;nanoarrow_array double[2]&gt;</span></span>
<span><span class="co">#&gt; .. ..$ length : int 2</span></span>
<span><span class="co">#&gt; .. ..$ null_count: int 0</span></span>
<span><span class="co">#&gt; .. ..$ offset : int 0</span></span>
<span><span class="co">#&gt; .. ..$ buffers :List of 2</span></span>
<span><span class="co">#&gt; .. .. ..$ :&lt;nanoarrow_buffer validity&lt;bool&gt;[0][0 b]&gt; ``</span></span>
<span><span class="co">#&gt; .. .. ..$ :&lt;nanoarrow_buffer data&lt;double&gt;[2][16 b]&gt; `1.1 2.2`</span></span>
<span><span class="co">#&gt; .. ..$ dictionary: NULL</span></span>
<span><span class="co">#&gt; .. ..$ children : list()</span></span>
<span><span class="co">#&gt; $ dictionary: NULL</span></span></code></pre></div>
<p>You can use <code><a href="https://rdrr.io/r/base/vector.html" class="external-link">as.vector()</a></code> or <code><a href="https://rdrr.io/r/base/as.data.frame.html" class="external-link">as.data.frame()</a></code> to get the R representation of the object back:</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">array</span> <span class="op">&lt;-</span> <span class="fu"><a href="reference/as_nanoarrow_array.html">as_nanoarrow_array</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>col1 <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1.1</span>, <span class="fl">2.2</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/as.data.frame.html" class="external-link">as.data.frame</a></span><span class="op">(</span><span class="va">array</span><span class="op">)</span></span>
<span><span class="co">#&gt; col1</span></span>
<span><span class="co">#&gt; 1 1.1</span></span>
<span><span class="co">#&gt; 2 2.2</span></span></code></pre></div>
<p>Even though at the C level the ArrowArray is distinct from the ArrowSchema, at the R level we attach a schema wherever possible. You can access the attached schema using <code><a href="reference/as_nanoarrow_schema.html">infer_nanoarrow_schema()</a></code>:</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="reference/as_nanoarrow_schema.html">infer_nanoarrow_schema</a></span><span class="op">(</span><span class="va">array</span><span class="op">)</span></span>
<span><span class="co">#&gt; &lt;nanoarrow_schema struct&gt;</span></span>
<span><span class="co">#&gt; $ format : chr "+s"</span></span>
<span><span class="co">#&gt; $ name : chr ""</span></span>
<span><span class="co">#&gt; $ metadata : list()</span></span>
<span><span class="co">#&gt; $ flags : int 0</span></span>
<span><span class="co">#&gt; $ children :List of 1</span></span>
<span><span class="co">#&gt; ..$ col1:&lt;nanoarrow_schema double&gt;</span></span>
<span><span class="co">#&gt; .. ..$ format : chr "g"</span></span>
<span><span class="co">#&gt; .. ..$ name : chr "col1"</span></span>
<span><span class="co">#&gt; .. ..$ metadata : list()</span></span>
<span><span class="co">#&gt; .. ..$ flags : int 2</span></span>
<span><span class="co">#&gt; .. ..$ children : list()</span></span>
<span><span class="co">#&gt; .. ..$ dictionary: NULL</span></span>
<span><span class="co">#&gt; $ dictionary: NULL</span></span></code></pre></div>
</div>
<div class="section level3">
<h3 id="array-streams">Array Streams<a class="anchor" aria-label="anchor" href="#array-streams"></a>
</h3>
<p>The easiest way to create an ArrowArrayStream is from a list of arrays or objects that can be converted to an array using <code><a href="reference/as_nanoarrow_array.html">as_nanoarrow_array()</a></code>:</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">stream</span> <span class="op">&lt;-</span> <span class="fu"><a href="reference/basic_array_stream.html">basic_array_stream</a></span><span class="op">(</span></span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>col1 <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1.1</span>, <span class="fl">2.2</span><span class="op">)</span><span class="op">)</span>,</span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>col1 <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">3.3</span>, <span class="fl">4.4</span><span class="op">)</span><span class="op">)</span></span>
<span> <span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
<p>You can pull batches from the stream using the <code>$get_next()</code> method. The last batch will return <code>NULL</code>.</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">stream</span><span class="op">$</span><span class="fu">get_next</span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co">#&gt; &lt;nanoarrow_array struct[2]&gt;</span></span>
<span><span class="co">#&gt; $ length : int 2</span></span>
<span><span class="co">#&gt; $ null_count: int 0</span></span>
<span><span class="co">#&gt; $ offset : int 0</span></span>
<span><span class="co">#&gt; $ buffers :List of 1</span></span>
<span><span class="co">#&gt; ..$ :&lt;nanoarrow_buffer validity&lt;bool&gt;[0][0 b]&gt; ``</span></span>
<span><span class="co">#&gt; $ children :List of 1</span></span>
<span><span class="co">#&gt; ..$ col1:&lt;nanoarrow_array double[2]&gt;</span></span>
<span><span class="co">#&gt; .. ..$ length : int 2</span></span>
<span><span class="co">#&gt; .. ..$ null_count: int 0</span></span>
<span><span class="co">#&gt; .. ..$ offset : int 0</span></span>
<span><span class="co">#&gt; .. ..$ buffers :List of 2</span></span>
<span><span class="co">#&gt; .. .. ..$ :&lt;nanoarrow_buffer validity&lt;bool&gt;[0][0 b]&gt; ``</span></span>
<span><span class="co">#&gt; .. .. ..$ :&lt;nanoarrow_buffer data&lt;double&gt;[2][16 b]&gt; `1.1 2.2`</span></span>
<span><span class="co">#&gt; .. ..$ dictionary: NULL</span></span>
<span><span class="co">#&gt; .. ..$ children : list()</span></span>
<span><span class="co">#&gt; $ dictionary: NULL</span></span>
<span><span class="va">stream</span><span class="op">$</span><span class="fu">get_next</span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co">#&gt; &lt;nanoarrow_array struct[2]&gt;</span></span>
<span><span class="co">#&gt; $ length : int 2</span></span>
<span><span class="co">#&gt; $ null_count: int 0</span></span>
<span><span class="co">#&gt; $ offset : int 0</span></span>
<span><span class="co">#&gt; $ buffers :List of 1</span></span>
<span><span class="co">#&gt; ..$ :&lt;nanoarrow_buffer validity&lt;bool&gt;[0][0 b]&gt; ``</span></span>
<span><span class="co">#&gt; $ children :List of 1</span></span>
<span><span class="co">#&gt; ..$ col1:&lt;nanoarrow_array double[2]&gt;</span></span>
<span><span class="co">#&gt; .. ..$ length : int 2</span></span>
<span><span class="co">#&gt; .. ..$ null_count: int 0</span></span>
<span><span class="co">#&gt; .. ..$ offset : int 0</span></span>
<span><span class="co">#&gt; .. ..$ buffers :List of 2</span></span>
<span><span class="co">#&gt; .. .. ..$ :&lt;nanoarrow_buffer validity&lt;bool&gt;[0][0 b]&gt; ``</span></span>
<span><span class="co">#&gt; .. .. ..$ :&lt;nanoarrow_buffer data&lt;double&gt;[2][16 b]&gt; `3.3 4.4`</span></span>
<span><span class="co">#&gt; .. ..$ dictionary: NULL</span></span>
<span><span class="co">#&gt; .. ..$ children : list()</span></span>
<span><span class="co">#&gt; $ dictionary: NULL</span></span>
<span><span class="va">stream</span><span class="op">$</span><span class="fu">get_next</span><span class="op">(</span><span class="op">)</span></span>
<span><span class="co">#&gt; NULL</span></span></code></pre></div>
<p>You can pull all the batches into a <code><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame()</a></code> by calling <code><a href="https://rdrr.io/r/base/as.data.frame.html" class="external-link">as.data.frame()</a></code> or <code><a href="https://rdrr.io/r/base/vector.html" class="external-link">as.vector()</a></code>:</p>
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">stream</span> <span class="op">&lt;-</span> <span class="fu"><a href="reference/basic_array_stream.html">basic_array_stream</a></span><span class="op">(</span></span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>col1 <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1.1</span>, <span class="fl">2.2</span><span class="op">)</span><span class="op">)</span>,</span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>col1 <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">3.3</span>, <span class="fl">4.4</span><span class="op">)</span><span class="op">)</span></span>
<span> <span class="op">)</span></span>
<span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/as.data.frame.html" class="external-link">as.data.frame</a></span><span class="op">(</span><span class="va">stream</span><span class="op">)</span></span>
<span><span class="co">#&gt; col1</span></span>
<span><span class="co">#&gt; 1 1.1</span></span>
<span><span class="co">#&gt; 2 2.2</span></span>
<span><span class="co">#&gt; 3 3.3</span></span>
<span><span class="co">#&gt; 4 4.4</span></span></code></pre></div>
<p>After consuming a stream, you should call the release method as soon as you can. This lets the implementation of the stream release any resources (like open files) it may be holding in a more predictable way than waiting for the garbage collector to clean up the object.</p>
</div>
</div>
<div class="section level2">
<h2 id="integration-with-the-arrow-package">Integration with the arrow package<a class="anchor" aria-label="anchor" href="#integration-with-the-arrow-package"></a>
</h2>
<p>The nanoarrow package implements <code><a href="reference/as_nanoarrow_schema.html">as_nanoarrow_schema()</a></code>, <code><a href="reference/as_nanoarrow_array.html">as_nanoarrow_array()</a></code>, and <code><a href="reference/as_nanoarrow_array_stream.html">as_nanoarrow_array_stream()</a></code> for most arrow package types. Similarly, it implements <code><a href="https://arrow.apache.org/docs/r/reference/as_arrow_array.html" class="external-link">arrow::as_arrow_array()</a></code>, <code><a href="https://arrow.apache.org/docs/r/reference/as_record_batch.html" class="external-link">arrow::as_record_batch()</a></code>, <code><a href="https://arrow.apache.org/docs/r/reference/as_arrow_table.html" class="external-link">arrow::as_arrow_table()</a></code>, <code><a href="https://arrow.apache.org/docs/r/reference/as_record_batch_reader.html" class="external-link">arrow::as_record_batch_reader()</a></code>, <code><a href="https://arrow.apache.org/docs/r/reference/infer_type.html" class="external-link">arrow::infer_type()</a></code>, <code><a href="https://arrow.apache.org/docs/r/reference/as_data_type.html" class="external-link">arrow::as_data_type()</a></code>, and <code><a href="https://arrow.apache.org/docs/r/reference/as_schema.html" class="external-link">arrow::as_schema()</a></code> for nanoarrow objects such that you can pass equivalent nanoarrow objects into many arrow functions and vice versa.</p>
</div>
</div>
</main><aside class="col-md-3"><div class="links">
<h2 data-toc-skip>Links</h2>
<ul class="list-unstyled">
<li><a href="https://cloud.r-project.org/package=nanoarrow" class="external-link">View on CRAN</a></li>
<li><a href="https://github.com/apache/arrow-nanoarrow/" class="external-link">Browse source code</a></li>
<li><a href="https://github.com/apache/arrow-nanoarrow/issues" class="external-link">Report a bug</a></li>
</ul>
</div>
<div class="license">
<h2 data-toc-skip>License</h2>
<ul class="list-unstyled">
<li><a href="LICENSE.html">Full license</a></li>
<li><small>Apache License (&gt;= 2)</small></li>
</ul>
</div>
<div class="citation">
<h2 data-toc-skip>Citation</h2>
<ul class="list-unstyled">
<li><a href="authors.html#citation">Citing nanoarrow</a></li>
</ul>
</div>
<div class="developers">
<h2 data-toc-skip>Developers</h2>
<ul class="list-unstyled">
<li>Dewey Dunnington <br><small class="roles"> Author, maintainer </small> <a href="https://orcid.org/0000-0002-9415-4582" target="orcid.widget" aria-label="ORCID" class="external-link"><span class="fab fa-orcid orcid" aria-hidden="true"></span></a> </li>
<li>Apache Arrow <br><small class="roles"> Author, copyright holder </small> </li>
<li><a href="authors.html">More about authors...</a></li>
</ul>
</div>
</aside>
</div>
<footer><div class="pkgdown-footer-left">
<p>Developed by Dewey Dunnington, Apache Arrow.</p>
</div>
<div class="pkgdown-footer-right">
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.0.</p>
</div>
</footer>
</div>
</body>
</html>