| |
| <!DOCTYPE html> |
| |
| |
| <html lang="en" data-content_root="../../../" > |
| |
| <head> |
| <meta charset="utf-8" /> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" /> |
| |
| <title>R tutorials — Apache Arrow v23.0.0.dev37</title> |
| |
| |
| |
| <script data-cfasync="false"> |
| document.documentElement.dataset.mode = localStorage.getItem("mode") || ""; |
| document.documentElement.dataset.theme = localStorage.getItem("theme") || ""; |
| </script> |
| <!-- |
| this give us a css class that will be invisible only if js is disabled |
| --> |
| <noscript> |
| <style> |
| .pst-js-only { display: none !important; } |
| |
| </style> |
| </noscript> |
| |
| <!-- Loaded before other Sphinx assets --> |
| <link href="../../../_static/styles/theme.css?digest=8878045cc6db502f8baf" rel="stylesheet" /> |
| <link href="../../../_static/styles/pydata-sphinx-theme.css?digest=8878045cc6db502f8baf" rel="stylesheet" /> |
| |
| <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=03e43079" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css?v=76b2166b" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/sphinx-design.min.css?v=95c83b7e" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/theme_overrides.css?v=8dcd28dc" /> |
| |
| <!-- So that users can add custom icons --> |
| <script src="../../../_static/scripts/fontawesome.js?digest=8878045cc6db502f8baf"></script> |
| <!-- Pre-loaded scripts that we'll load fully later --> |
| <link rel="preload" as="script" href="../../../_static/scripts/bootstrap.js?digest=8878045cc6db502f8baf" /> |
| <link rel="preload" as="script" href="../../../_static/scripts/pydata-sphinx-theme.js?digest=8878045cc6db502f8baf" /> |
| |
| <script src="../../../_static/documentation_options.js?v=9fc6757a"></script> |
| <script src="../../../_static/doctools.js?v=9bcbadda"></script> |
| <script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> |
| <script src="../../../_static/clipboard.min.js?v=a7894cd8"></script> |
| <script src="../../../_static/copybutton.js?v=3bb21c8c"></script> |
| <script src="../../../_static/design-tabs.js?v=f930bc37"></script> |
| <script>DOCUMENTATION_OPTIONS.pagename = 'developers/guide/tutorials/r_tutorial';</script> |
| <script> |
| DOCUMENTATION_OPTIONS.theme_version = '0.16.1'; |
| DOCUMENTATION_OPTIONS.theme_switcher_json_url = '/docs/_static/versions.json'; |
| DOCUMENTATION_OPTIONS.theme_switcher_version_match = 'dev/'; |
| DOCUMENTATION_OPTIONS.show_version_warning_banner = |
| true; |
| </script> |
| <link rel="canonical" href="https://arrow.apache.org/docs/developers/guide/tutorials/r_tutorial.html" /> |
| <link rel="icon" href="../../../_static/favicon.ico"/> |
| <link rel="index" title="Index" href="../../../genindex.html" /> |
| <link rel="search" title="Search" href="../../../search.html" /> |
| <link rel="next" title="Additional information and resources" href="../resources.html" /> |
| <link rel="prev" title="Python tutorial" href="python_tutorial.html" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| <meta name="docsearch:language" content="en"/> |
| <meta name="docsearch:version" content="23.0.0.dev37" /> |
| |
| <!-- Matomo --> |
| <script> |
| var _paq = window._paq = window._paq || []; |
| /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ |
| /* We explicitly disable cookie tracking to avoid privacy issues */ |
| _paq.push(['disableCookies']); |
| _paq.push(['trackPageView']); |
| _paq.push(['enableLinkTracking']); |
| (function() { |
| var u="https://analytics.apache.org/"; |
| _paq.push(['setTrackerUrl', u+'matomo.php']); |
| _paq.push(['setSiteId', '20']); |
| var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; |
| g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); |
| })(); |
| </script> |
| <!-- End Matomo Code --> |
| |
| </head> |
| |
| |
| <body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode=""> |
| |
| |
| |
| <div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div> |
| |
| <div id="pst-scroll-pixel-helper"></div> |
| |
| <button type="button" class="btn rounded-pill" id="pst-back-to-top"> |
| <i class="fa-solid fa-arrow-up"></i>Back to top</button> |
| |
| |
| <dialog id="pst-search-dialog"> |
| |
| <form class="bd-search d-flex align-items-center" |
| action="../../../search.html" |
| method="get"> |
| <i class="fa-solid fa-magnifying-glass"></i> |
| <input type="search" |
| class="form-control" |
| name="q" |
| placeholder="Search the docs ..." |
| aria-label="Search the docs ..." |
| autocomplete="off" |
| autocorrect="off" |
| autocapitalize="off" |
| spellcheck="false"/> |
| <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span> |
| </form> |
| </dialog> |
| |
| <div class="pst-async-banner-revealer d-none"> |
| <aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside> |
| </div> |
| |
| |
| <header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none"> |
| <div class="bd-header__inner bd-page-width"> |
| <button class="pst-navbar-icon sidebar-toggle primary-toggle" aria-label="Site navigation"> |
| <span class="fa-solid fa-bars"></span> |
| </button> |
| |
| |
| <div class=" navbar-header-items__start"> |
| |
| <div class="navbar-item"> |
| |
| |
| |
| |
| |
| <a class="navbar-brand logo" href="../../../index.html"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <img src="../../../_static/arrow.png" class="logo__image only-light" alt="Apache Arrow v23.0.0.dev37 - Home"/> |
| <img src="../../../_static/arrow-dark.png" class="logo__image only-dark pst-js-only" alt="Apache Arrow v23.0.0.dev37 - Home"/> |
| |
| |
| </a></div> |
| |
| </div> |
| |
| <div class=" navbar-header-items"> |
| |
| <div class="me-auto navbar-header-items__center"> |
| |
| <div class="navbar-item"> |
| <nav> |
| <ul class="bd-navbar-elements navbar-nav"> |
| |
| <li class="nav-item "> |
| <a class="nav-link nav-internal" href="../../../format/index.html"> |
| Specifications |
| </a> |
| </li> |
| |
| |
| <li class="nav-item current active"> |
| <a class="nav-link nav-internal" href="../../index.html"> |
| Development |
| </a> |
| </li> |
| |
| |
| <li class="nav-item "> |
| <a class="nav-link nav-internal" href="../../../implementations.html"> |
| Implementations |
| </a> |
| </li> |
| |
| </ul> |
| </nav></div> |
| |
| </div> |
| |
| |
| <div class="navbar-header-items__end"> |
| |
| <div class="navbar-item navbar-persistent--container"> |
| |
| |
| <button class="btn search-button-field search-button__button pst-js-only" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip"> |
| <i class="fa-solid fa-magnifying-glass"></i> |
| <span class="search-button__default-text">Search</span> |
| <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span> |
| </button> |
| </div> |
| |
| |
| <div class="navbar-item"><div class="kapa-ai-bot"> |
| <script |
| async |
| src="https://widget.kapa.ai/kapa-widget.bundle.js" |
| data-website-id="9db461d5-ac77-4b3f-a5c5-75efa78339d2" |
| data-project-name="Apache Arrow" |
| data-project-color="#000000" |
| data-project-logo="https://arrow.apache.org/img/arrow-logo_chevrons_white-txt_black-bg.png" |
| data-modal-disclaimer="This is a custom LLM with access to all [Arrow documentation](https://arrow.apache.org/docs/). Please include the language you are using in your question, e.g., Python, C++, Java, R, etc." |
| data-consent-required="true" |
| data-user-analytics-cookie-enabled="false" |
| data-consent-screen-disclaimer="By clicking "I agree, let's chat", you consent to the use of the AI assistant in accordance with kapa.ai's [Privacy Policy](https://www.kapa.ai/content/privacy-policy). This service uses reCAPTCHA, which requires your consent to Google's [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms). By proceeding, you explicitly agree to both kapa.ai's and Google's privacy policies." |
| ></script> |
| |
| </div> |
| |
| </div> |
| |
| <div class="navbar-item"> |
| <div class="version-switcher__container dropdown pst-js-only"> |
| <button id="pst-version-switcher-button-2" |
| type="button" |
| class="version-switcher__button btn btn-sm dropdown-toggle" |
| data-bs-toggle="dropdown" |
| aria-haspopup="listbox" |
| aria-controls="pst-version-switcher-list-2" |
| aria-label="Version switcher list" |
| > |
| Choose version <!-- this text may get changed later by javascript --> |
| <span class="caret"></span> |
| </button> |
| <div id="pst-version-switcher-list-2" |
| class="version-switcher__menu dropdown-menu list-group-flush py-0" |
| role="listbox" aria-labelledby="pst-version-switcher-button-2"> |
| <!-- dropdown will be populated by javascript on page load --> |
| </div> |
| </div></div> |
| |
| <div class="navbar-item"> |
| |
| <button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button pst-js-only" aria-label="Color mode" data-bs-title="Color mode" data-bs-placement="bottom" data-bs-toggle="tooltip"> |
| <i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light" title="Light"></i> |
| <i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark" title="Dark"></i> |
| <i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto" title="System Settings"></i> |
| </button></div> |
| |
| <div class="navbar-item"><ul class="navbar-icon-links" |
| aria-label="Icon Links"> |
| <li class="nav-item"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a href="https://github.com/apache/arrow" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i> |
| <span class="sr-only">GitHub</span></a> |
| </li> |
| <li class="nav-item"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a href="https://www.linkedin.com/company/apache-arrow/" title="LinkedIn" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-linkedin fa-lg" aria-hidden="true"></i> |
| <span class="sr-only">LinkedIn</span></a> |
| </li> |
| <li class="nav-item"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a href="https://bsky.app/profile/arrow.apache.org" title="BlueSky" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-bluesky fa-lg" aria-hidden="true"></i> |
| <span class="sr-only">BlueSky</span></a> |
| </li> |
| </ul></div> |
| |
| </div> |
| |
| </div> |
| |
| |
| <div class="navbar-persistent--mobile"> |
| |
| <button class="btn search-button-field search-button__button pst-js-only" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip"> |
| <i class="fa-solid fa-magnifying-glass"></i> |
| <span class="search-button__default-text">Search</span> |
| <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span> |
| </button> |
| </div> |
| |
| |
| |
| <button class="pst-navbar-icon sidebar-toggle secondary-toggle" aria-label="On this page"> |
| <span class="fa-solid fa-outdent"></span> |
| </button> |
| |
| </div> |
| |
| </header> |
| |
| |
| <div class="bd-container"> |
| <div class="bd-container__inner bd-page-width"> |
| |
| |
| |
| <dialog id="pst-primary-sidebar-modal"></dialog> |
| <div id="pst-primary-sidebar" class="bd-sidebar-primary bd-sidebar"> |
| |
| |
| |
| <div class="sidebar-header-items sidebar-primary__section"> |
| |
| |
| <div class="sidebar-header-items__center"> |
| |
| |
| |
| <div class="navbar-item"> |
| <nav> |
| <ul class="bd-navbar-elements navbar-nav"> |
| |
| <li class="nav-item "> |
| <a class="nav-link nav-internal" href="../../../format/index.html"> |
| Specifications |
| </a> |
| </li> |
| |
| |
| <li class="nav-item current active"> |
| <a class="nav-link nav-internal" href="../../index.html"> |
| Development |
| </a> |
| </li> |
| |
| |
| <li class="nav-item "> |
| <a class="nav-link nav-internal" href="../../../implementations.html"> |
| Implementations |
| </a> |
| </li> |
| |
| </ul> |
| </nav></div> |
| |
| |
| </div> |
| |
| |
| |
| <div class="sidebar-header-items__end"> |
| |
| <div class="navbar-item"><div class="kapa-ai-bot"> |
| <script |
| async |
| src="https://widget.kapa.ai/kapa-widget.bundle.js" |
| data-website-id="9db461d5-ac77-4b3f-a5c5-75efa78339d2" |
| data-project-name="Apache Arrow" |
| data-project-color="#000000" |
| data-project-logo="https://arrow.apache.org/img/arrow-logo_chevrons_white-txt_black-bg.png" |
| data-modal-disclaimer="This is a custom LLM with access to all [Arrow documentation](https://arrow.apache.org/docs/). Please include the language you are using in your question, e.g., Python, C++, Java, R, etc." |
| data-consent-required="true" |
| data-user-analytics-cookie-enabled="false" |
| data-consent-screen-disclaimer="By clicking "I agree, let's chat", you consent to the use of the AI assistant in accordance with kapa.ai's [Privacy Policy](https://www.kapa.ai/content/privacy-policy). This service uses reCAPTCHA, which requires your consent to Google's [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms). By proceeding, you explicitly agree to both kapa.ai's and Google's privacy policies." |
| ></script> |
| |
| </div> |
| |
| </div> |
| |
| <div class="navbar-item"> |
| <div class="version-switcher__container dropdown pst-js-only"> |
| <button id="pst-version-switcher-button-3" |
| type="button" |
| class="version-switcher__button btn btn-sm dropdown-toggle" |
| data-bs-toggle="dropdown" |
| aria-haspopup="listbox" |
| aria-controls="pst-version-switcher-list-3" |
| aria-label="Version switcher list" |
| > |
| Choose version <!-- this text may get changed later by javascript --> |
| <span class="caret"></span> |
| </button> |
| <div id="pst-version-switcher-list-3" |
| class="version-switcher__menu dropdown-menu list-group-flush py-0" |
| role="listbox" aria-labelledby="pst-version-switcher-button-3"> |
| <!-- dropdown will be populated by javascript on page load --> |
| </div> |
| </div></div> |
| |
| <div class="navbar-item"> |
| |
| <button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button pst-js-only" aria-label="Color mode" data-bs-title="Color mode" data-bs-placement="bottom" data-bs-toggle="tooltip"> |
| <i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light" title="Light"></i> |
| <i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark" title="Dark"></i> |
| <i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto" title="System Settings"></i> |
| </button></div> |
| |
| <div class="navbar-item"><ul class="navbar-icon-links" |
| aria-label="Icon Links"> |
| <li class="nav-item"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a href="https://github.com/apache/arrow" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i> |
| <span class="sr-only">GitHub</span></a> |
| </li> |
| <li class="nav-item"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a href="https://www.linkedin.com/company/apache-arrow/" title="LinkedIn" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-linkedin fa-lg" aria-hidden="true"></i> |
| <span class="sr-only">LinkedIn</span></a> |
| </li> |
| <li class="nav-item"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <a href="https://bsky.app/profile/arrow.apache.org" title="BlueSky" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-bluesky fa-lg" aria-hidden="true"></i> |
| <span class="sr-only">BlueSky</span></a> |
| </li> |
| </ul></div> |
| |
| </div> |
| |
| </div> |
| |
| <div class="sidebar-primary-items__start sidebar-primary__section"> |
| <div class="sidebar-primary-item"> |
| <nav class="bd-docs-nav bd-links" |
| aria-label="Section Navigation"> |
| <p class="bd-links__title" role="heading" aria-level="1">Section Navigation</p> |
| <div class="bd-toc-item navbar-nav"><ul class="current nav bd-sidenav"> |
| <li class="toctree-l1"><a class="reference internal" href="../../bug_reports.html">Bug reports and feature requests</a></li> |
| <li class="toctree-l1 current active has-children"><a class="reference internal" href="../index.html">New Contributor’s Guide</a><details open="open"><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../architectural_overview.html">Architectural Overview</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../communication.html">Communication</a></li> |
| <li class="toctree-l2 has-children"><a class="reference internal" href="../step_by_step/index.html">Steps in making your first PR</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../step_by_step/set_up.html">Set up</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../step_by_step/building.html">Building the Arrow libraries 🏋🏿♀️</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../step_by_step/finding_issues.html">Finding good first issues 🔎</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../step_by_step/arrow_codebase.html">Working on the Arrow codebase 🧐</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../step_by_step/testing.html">Testing 🧪</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../step_by_step/styling.html">Styling 😎</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../step_by_step/pr_lifecycle.html">Lifecycle of a pull request</a></li> |
| </ul> |
| </details></li> |
| <li class="toctree-l2"><a class="reference internal" href="../documentation.html">Helping with documentation</a></li> |
| <li class="toctree-l2 current active has-children"><a class="reference internal" href="index.html">Tutorials</a><details open="open"><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="python_tutorial.html">Python tutorial</a></li> |
| <li class="toctree-l3 current active"><a class="current reference internal" href="#">R tutorials</a></li> |
| </ul> |
| </details></li> |
| <li class="toctree-l2"><a class="reference internal" href="../resources.html">Additional information and resources</a></li> |
| </ul> |
| </details></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../overview.html">Contributing Overview</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../reviewing.html">Reviewing contributions</a></li> |
| <li class="toctree-l1 has-children"><a class="reference internal" href="../../cpp/index.html">C++ Development</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../../cpp/building.html">Building Arrow C++</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../cpp/development.html">Development Guidelines</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../cpp/windows.html">Developing on Windows</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../cpp/emscripten.html">Cross compiling for WebAssembly with Emscripten</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../cpp/conventions.html">Conventions</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../cpp/fuzzing.html">Fuzzing Arrow C++</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../cpp/compute.html">Developing Arrow C++ Compute</a></li> |
| <li class="toctree-l2 has-children"><a class="reference internal" href="../../cpp/acero.html">Developing Acero</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../cpp/acero/swiss_table.html">Swiss Table</a></li> |
| </ul> |
| </details></li> |
| </ul> |
| </details></li> |
| <li class="toctree-l1 has-children"><a class="reference internal" href="../../java/index.html">Java Development</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../../java/building.html">Building Arrow Java</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../java/development.html">Development Guidelines</a></li> |
| </ul> |
| </details></li> |
| <li class="toctree-l1 has-children"><a class="reference internal" href="../../python/index.html">Python Development</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../../python/building.html">Building PyArrow</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../python/development.html">Developing PyArrow</a></li> |
| </ul> |
| </details></li> |
| <li class="toctree-l1 has-children"><a class="reference internal" href="../../continuous_integration/index.html">Continuous Integration</a><details><summary><span class="toctree-toggle" role="presentation"><i class="fa-solid fa-chevron-down"></i></span></summary><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../../continuous_integration/overview.html">Continuous Integration</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../continuous_integration/docker.html">Running Docker Builds</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../continuous_integration/archery.html">Daily Development using Archery</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../continuous_integration/crossbow.html">Packaging and Testing with Crossbow</a></li> |
| </ul> |
| </details></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../benchmarks.html">Benchmarks</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../documentation.html">Building the Documentation</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../release.html">Release Management Guide</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../release_verification.html">Release Verification Process</a></li> |
| </ul> |
| </div> |
| </nav></div> |
| </div> |
| |
| |
| <div class="sidebar-primary-items__end sidebar-primary__section"> |
| <div class="sidebar-primary-item"> |
| <div id="ethical-ad-placement" |
| class="flat" |
| data-ea-publisher="readthedocs" |
| data-ea-type="readthedocs-sidebar" |
| data-ea-manual="true"> |
| </div></div> |
| </div> |
| |
| |
| </div> |
| |
| <main id="main-content" class="bd-main" role="main"> |
| |
| |
| <div class="bd-content"> |
| <div class="bd-article-container"> |
| |
| <div class="bd-header-article d-print-none"> |
| <div class="header-article-items header-article__inner"> |
| |
| <div class="header-article-items__start"> |
| |
| <div class="header-article-item"> |
| |
| <nav aria-label="Breadcrumb" class="d-print-none"> |
| <ul class="bd-breadcrumbs"> |
| |
| <li class="breadcrumb-item breadcrumb-home"> |
| <a href="../../../index.html" class="nav-link" aria-label="Home"> |
| <i class="fa-solid fa-home"></i> |
| </a> |
| </li> |
| |
| <li class="breadcrumb-item"><a href="../../index.html" class="nav-link">Development</a></li> |
| |
| |
| <li class="breadcrumb-item"><a href="../index.html" class="nav-link">New Contributor’s Guide</a></li> |
| |
| |
| <li class="breadcrumb-item"><a href="index.html" class="nav-link">Tutorials</a></li> |
| |
| <li class="breadcrumb-item active" aria-current="page"><span class="ellipsis">R tutorials</span></li> |
| </ul> |
| </nav> |
| </div> |
| |
| </div> |
| |
| |
| </div> |
| </div> |
| |
| |
| |
| |
| <div id="searchbox"></div> |
| <article class="bd-article"> |
| |
| <section id="r-tutorials"> |
| <span id="r-tutorial"></span><h1>R tutorials<a class="headerlink" href="#r-tutorials" title="Link to this heading">#</a></h1> |
| <section id="r-tutorial-on-adding-a-lubridate-binding"> |
| <h2>R tutorial on adding a lubridate binding<a class="headerlink" href="#r-tutorial-on-adding-a-lubridate-binding" title="Link to this heading">#</a></h2> |
| <p>In this tutorial, we will document the contribution of a binding |
| to Arrow R package following the steps specified by the |
| <a class="reference internal" href="../index.html#quick-ref-guide"><span class="std std-ref">Quick Reference</span></a> section of the guide and a more detailed |
| <a class="reference internal" href="../step_by_step/index.html#step-by-step"><span class="std std-ref">Steps in making your first PR</span></a> section. Navigate there whenever there is |
| some information you may find is missing here.</p> |
| <p>The binding will be added to the <code class="docutils literal notranslate"><span class="pre">expression.R</span></code> file in the |
| R package. But you can also follow these steps in case you are |
| adding a binding that will live somewhere else.</p> |
| <p>This tutorial is different from the <a class="reference internal" href="../step_by_step/index.html#step-by-step"><span class="std std-ref">Steps in making your first PR</span></a> as we |
| will be working on a specific case. This tutorial is not meant |
| as a step-by-step guide.</p> |
| <p><strong>Let’s start!</strong></p> |
| <section id="set-up"> |
| <h3>Set up<a class="headerlink" href="#set-up" title="Link to this heading">#</a></h3> |
| <p>Let’s set up the Arrow repository. We presume here that Git is |
| already installed. Otherwise please see the <a class="reference internal" href="../step_by_step/set_up.html#set-up"><span class="std std-ref">Set up</span></a> section.</p> |
| <p>Once the <a class="reference external" href="https://github.com/apache/arrow">Apache Arrow repository</a> |
| is forked (see <a class="reference internal" href="../step_by_step/set_up.html#fork-repo-guide"><span class="std std-ref">Fork the repository</span></a>) we will clone it and add the |
| link of the main repository to our upstream.</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/<your<span class="w"> </span>username>/arrow.git |
| <span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>arrow |
| <span class="gp">$ </span>git<span class="w"> </span>remote<span class="w"> </span>add<span class="w"> </span>upstream<span class="w"> </span>https://github.com/apache/arrow |
| </pre></div> |
| </div> |
| </section> |
| <section id="building-r-package"> |
| <h3>Building R package<a class="headerlink" href="#building-r-package" title="Link to this heading">#</a></h3> |
| <p>The steps to follow for building the R package differs depending on the operating |
| system you are using. For this reason we will only refer to |
| the instructions for the building process in this tutorial.</p> |
| <div class="admonition seealso"> |
| <p class="admonition-title">See also</p> |
| <p>For the <strong>introduction</strong> to the building process refer to the |
| <a class="reference internal" href="../step_by_step/building.html#build-arrow-guide"><span class="std std-ref">Building the Arrow libraries 🏋🏿♀️</span></a> section.</p> |
| <p>For the <strong>instructions</strong> on how to build the R package refer to the |
| <a class="reference external" href="https://arrow.apache.org/docs/r/articles/developing.html">R developer docs</a>.</p> |
| </div> |
| </section> |
| <section id="the-issue"> |
| <h3>The issue<a class="headerlink" href="#the-issue" title="Link to this heading">#</a></h3> |
| <p>In this tutorial we will be tackling an issue for implementing |
| a simple binding for <code class="docutils literal notranslate"><span class="pre">mday()</span></code> function that will match that of the |
| existing R function from <code class="docutils literal notranslate"><span class="pre">lubridate</span></code>.</p> |
| <div class="admonition note"> |
| <p class="admonition-title">Note</p> |
| <p>If you do not have an issue and you need help finding one please refer |
| to the <a class="reference internal" href="../step_by_step/finding_issues.html#finding-issues"><span class="std std-ref">Finding good first issues 🔎</span></a> part of the guide.</p> |
| </div> |
| <p>Once you have an issue picked out and assigned to yourself, you can |
| proceed to the next step.</p> |
| </section> |
| <section id="start-the-work-on-a-new-branch"> |
| <h3>Start the work on a new branch<a class="headerlink" href="#start-the-work-on-a-new-branch" title="Link to this heading">#</a></h3> |
| <p>Before we start working on adding the binding we should |
| create a new branch from the updated main.</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>checkout<span class="w"> </span>main |
| <span class="gp">$ </span>git<span class="w"> </span>fetch<span class="w"> </span>upstream |
| <span class="gp">$ </span>git<span class="w"> </span>pull<span class="w"> </span>--ff-only<span class="w"> </span>upstream<span class="w"> </span>main |
| <span class="gp">$ </span>git<span class="w"> </span>checkout<span class="w"> </span>-b<span class="w"> </span>ARROW-14816 |
| </pre></div> |
| </div> |
| <p>Now we can start with researching the R function and the C++ Arrow |
| compute function we want to expose or connect to.</p> |
| <p><strong>Examine the lubridate mday() function</strong></p> |
| <p>Going through the <a class="reference external" href="https://lubridate.tidyverse.org/reference/day.html">lubridate documentation</a> |
| we can see that <code class="docutils literal notranslate"><span class="pre">mday()</span></code> takes a date object |
| and returns the day of the month as a numeric object.</p> |
| <p>We can run some examples in the R console to help us understand |
| the function better:</p> |
| <div class="highlight-R notranslate"><div class="highlight"><pre><span></span><span class="o">></span><span class="w"> </span><span class="nf">library</span><span class="p">(</span><span class="n">lubridate</span><span class="p">)</span> |
| <span class="o">></span><span class="w"> </span><span class="nf">mday</span><span class="p">(</span><span class="nf">as.Date</span><span class="p">(</span><span class="s">"2000-12-31"</span><span class="p">))</span> |
| <span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="m">31</span> |
| <span class="o">></span><span class="w"> </span><span class="nf">mday</span><span class="p">(</span><span class="nf">ymd</span><span class="p">(</span><span class="m">080306</span><span class="p">))</span> |
| <span class="p">[</span><span class="m">1</span><span class="p">]</span><span class="w"> </span><span class="m">6</span> |
| </pre></div> |
| </div> |
| <p><strong>Examine the Arrow C++ day() function</strong></p> |
| <p>From the <a class="reference external" href="https://arrow.apache.org/docs/cpp/compute.html#containment-tests">compute function documentation</a> |
| we can see that <code class="docutils literal notranslate"><span class="pre">day</span></code> is a unary function, which means that it takes |
| a single data input. The data input must be a <code class="docutils literal notranslate"><span class="pre">Temporal</span> <span class="pre">class</span></code> and |
| the returned value is an <code class="docutils literal notranslate"><span class="pre">Integer/numeric</span></code> type.</p> |
| <p>The <code class="docutils literal notranslate"><span class="pre">Temporal</span> <span class="pre">class</span></code> is specified as: Date types (Date32, Date64), |
| Time types (Time32, Time64), Timestamp, Duration, Interval.</p> |
| <p>We can call an Arrow C++ function from an R console using <code class="docutils literal notranslate"><span class="pre">call_function</span></code> |
| to see how it works:</p> |
| <div class="highlight-R notranslate"><div class="highlight"><pre><span></span><span class="o">></span><span class="w"> </span><span class="nf">call_function</span><span class="p">(</span><span class="s">"day"</span><span class="p">,</span><span class="w"> </span><span class="n">Scalar</span><span class="o">$</span><span class="nf">create</span><span class="p">(</span><span class="n">lubridate</span><span class="o">::</span><span class="nf">ymd</span><span class="p">(</span><span class="s">"2000-12-31"</span><span class="p">)))</span> |
| <span class="n">Scalar</span> |
| <span class="m">31</span> |
| </pre></div> |
| </div> |
| <p>We can see that lubridate and Arrow functions operate on and return |
| equivalent data types. lubridate’s <code class="docutils literal notranslate"><span class="pre">mday()</span></code> function has no additional |
| arguments and there are also no option classes associated with Arrow C++ |
| function <code class="docutils literal notranslate"><span class="pre">day()</span></code>.</p> |
| <p>Looking at the code in <code class="docutils literal notranslate"><span class="pre">expressions.R</span></code> we can see the day function |
| is already specified/mapped on the R package side: |
| <a class="github reference external" href="https://github.com/apache/arrow/blob/658bec37aa5cbdd53b5e4cdc81b8ba3962e67f11/r/R/expression.R#L63-L64">apache/arrow</a></p> |
| <p>We only need to add <code class="docutils literal notranslate"><span class="pre">mday()</span></code> to the list of expressions connecting |
| it to the C++ <code class="docutils literal notranslate"><span class="pre">day</span></code> function.</p> |
| <div class="highlight-R notranslate"><div class="highlight"><pre><span></span><span class="c1"># second is defined in dplyr-functions.R</span> |
| <span class="c1"># wday is defined in dplyr-functions.R</span> |
| <span class="s">"mday"</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"day"</span><span class="p">,</span> |
| <span class="s">"yday"</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"day_of_year"</span><span class="p">,</span> |
| <span class="s">"year"</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"year"</span><span class="p">,</span> |
| </pre></div> |
| </div> |
| </section> |
| <section id="adding-a-test"> |
| <h3>Adding a test<a class="headerlink" href="#adding-a-test" title="Link to this heading">#</a></h3> |
| <p>Now we need to add a test that checks if everything works well. |
| If there are additional options or edge cases, we would have to |
| add more. Looking at tests for similar functions (for example |
| <code class="docutils literal notranslate"><span class="pre">yday()</span></code> or <code class="docutils literal notranslate"><span class="pre">day())</span></code> we can see that a good place to add two |
| tests we have is in <code class="docutils literal notranslate"><span class="pre">test-dplyr-funcs-datetime.R</span></code>:</p> |
| <div class="highlight-R notranslate"><div class="highlight"><pre><span></span><span class="nf">test_that</span><span class="p">(</span><span class="s">"extract mday from timestamp"</span><span class="p">,</span><span class="w"> </span><span class="p">{</span> |
| <span class="w"> </span><span class="nf">compare_dplyr_binding</span><span class="p">(</span> |
| <span class="w"> </span><span class="n">.input</span><span class="w"> </span><span class="o">%>%</span> |
| <span class="w"> </span><span class="nf">mutate</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">mday</span><span class="p">(</span><span class="n">datetime</span><span class="p">))</span><span class="w"> </span><span class="o">%>%</span> |
| <span class="w"> </span><span class="nf">collect</span><span class="p">(),</span> |
| <span class="w"> </span><span class="n">test_df</span> |
| <span class="w"> </span><span class="p">)</span> |
| <span class="p">})</span> |
| </pre></div> |
| </div> |
| <p>And</p> |
| <div class="highlight-R notranslate"><div class="highlight"><pre><span></span><span class="nf">test_that</span><span class="p">(</span><span class="s">"extract mday from date"</span><span class="p">,</span><span class="w"> </span><span class="p">{</span> |
| <span class="w"> </span><span class="nf">compare_dplyr_binding</span><span class="p">(</span> |
| <span class="w"> </span><span class="n">.input</span><span class="w"> </span><span class="o">%>%</span> |
| <span class="w"> </span><span class="nf">mutate</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">mday</span><span class="p">(</span><span class="n">date</span><span class="p">))</span><span class="w"> </span><span class="o">%>%</span> |
| <span class="w"> </span><span class="nf">collect</span><span class="p">(),</span> |
| <span class="w"> </span><span class="n">test_df</span> |
| <span class="w"> </span><span class="p">)</span> |
| <span class="p">})</span> |
| </pre></div> |
| </div> |
| <p>Now we need to see if the tests are passing or we need to do some |
| more research and code corrections.</p> |
| <div class="highlight-R notranslate"><div class="highlight"><pre><span></span><span class="n">devtools</span><span class="o">::</span><span class="nf">test</span><span class="p">(</span><span class="n">filter</span><span class="o">=</span><span class="s">"datetime"</span><span class="p">)</span> |
| |
| <span class="o">></span><span class="w"> </span><span class="n">devtools</span><span class="o">::</span><span class="nf">test</span><span class="p">(</span><span class="n">filter</span><span class="o">=</span><span class="s">"datetime"</span><span class="p">)</span> |
| ℹ<span class="w"> </span><span class="n">Loading</span><span class="w"> </span><span class="n">arrow</span> |
| <span class="n">See</span><span class="w"> </span><span class="nf">arrow_info</span><span class="p">()</span><span class="w"> </span><span class="kr">for</span><span class="w"> </span><span class="n">available</span><span class="w"> </span><span class="n">features</span> |
| ℹ<span class="w"> </span><span class="n">Testing</span><span class="w"> </span><span class="n">arrow</span> |
| <span class="n">See</span><span class="w"> </span><span class="nf">arrow_info</span><span class="p">()</span><span class="w"> </span><span class="kr">for</span><span class="w"> </span><span class="n">available</span><span class="w"> </span><span class="n">features</span> |
| ✔<span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="bp">F</span><span class="w"> </span><span class="n">W</span><span class="w"> </span><span class="n">S</span><span class="w"> </span><span class="n">OK</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Context</span> |
| ✖<span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="m">230</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dplyr</span><span class="o">-</span><span class="n">funcs</span><span class="o">-</span><span class="n">datetime</span><span class="w"> </span><span class="p">[</span><span class="m">1.4</span><span class="n">s</span><span class="p">]</span> |
| ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
| <span class="nf">Failure </span><span class="p">(</span><span class="n">test</span><span class="o">-</span><span class="n">dplyr</span><span class="o">-</span><span class="n">funcs</span><span class="o">-</span><span class="n">datetime.R</span><span class="o">:</span><span class="m">187</span><span class="o">:</span><span class="m">3</span><span class="p">)</span><span class="o">:</span><span class="w"> </span><span class="n">strftime</span> |
| <span class="n">``</span><span class="o">%>%</span><span class="n">`(...)`</span><span class="w"> </span><span class="n">did</span><span class="w"> </span><span class="n">not</span><span class="w"> </span><span class="n">throw</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">expected</span><span class="w"> </span><span class="n">error.</span> |
| <span class="n">Backtrace</span><span class="o">:</span> |
| <span class="w"> </span><span class="m">1</span><span class="n">.</span><span class="w"> </span><span class="n">testthat</span><span class="o">::</span><span class="nf">expect_error</span><span class="p">(</span><span class="kc">...</span><span class="p">)</span><span class="w"> </span><span class="n">test</span><span class="o">-</span><span class="n">dplyr</span><span class="o">-</span><span class="n">funcs</span><span class="o">-</span><span class="n">datetime.R</span><span class="o">:</span><span class="m">187</span><span class="o">:</span><span class="m">2</span> |
| <span class="w"> </span><span class="m">2</span><span class="n">.</span><span class="w"> </span><span class="n">testthat</span><span class="o">:::</span><span class="nf">expect_condition_matching</span><span class="p">(</span><span class="kc">...</span><span class="p">)</span> |
| ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
| |
| ══<span class="w"> </span><span class="n">Results</span><span class="w"> </span>═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ |
| <span class="n">Duration</span><span class="o">:</span><span class="w"> </span><span class="m">1.4</span><span class="w"> </span><span class="n">s</span> |
| |
| <span class="p">[</span><span class="w"> </span><span class="n">FAIL</span><span class="w"> </span><span class="m">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">WARN</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">SKIP</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">PASS</span><span class="w"> </span><span class="m">230</span><span class="w"> </span><span class="p">]</span> |
| </pre></div> |
| </div> |
| <p>There is a failure we get for the <code class="docutils literal notranslate"><span class="pre">strftime</span></code> function but looking |
| at the code we see is not connected to our work. We can move on and |
| maybe ask others if they are getting similar fail when running the tests. |
| It could be we only need to rebuild the library.</p> |
| </section> |
| <section id="check-styling"> |
| <h3>Check styling<a class="headerlink" href="#check-styling" title="Link to this heading">#</a></h3> |
| <p>We should also run linters to check that the styling of the code |
| follows the <a class="reference external" href="https://style.tidyverse.org/">tidyverse style</a>. To |
| do that we run the following command in the shell:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>make<span class="w"> </span>style |
| <span class="go">R -s -e 'setwd(".."); if (requireNamespace("styler")) styler::style_file(setdiff(system("git diff --name-only | grep r/.*R$", intern = TRUE), file.path("r", source("r/.styler_excludes.R")$value)))'</span> |
| <span class="go">Loading required namespace: styler</span> |
| <span class="go">Styling 2 files:</span> |
| <span class="go"> r/R/expression.R ✔</span> |
| <span class="go"> r/tests/testthat/test-dplyr-funcs-datetime.R ℹ</span> |
| <span class="go">────────────────────────────────────────────</span> |
| <span class="go">Status Count Legend</span> |
| <span class="go">✔ 1 File unchanged.</span> |
| <span class="go">ℹ 1 File changed.</span> |
| <span class="go">✖ 0 Styling threw an error.</span> |
| <span class="go">────────────────────────────────────────────</span> |
| <span class="go">Please review the changes carefully!</span> |
| </pre></div> |
| </div> |
| </section> |
| <section id="creating-a-pull-request"> |
| <h3>Creating a Pull Request<a class="headerlink" href="#creating-a-pull-request" title="Link to this heading">#</a></h3> |
| <p>First let’s review our changes in the shell using <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">status</span></code> to see |
| which files have been changed and to commit only the ones we are working on.</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>status |
| <span class="go">On branch ARROW-14816</span> |
| <span class="go">Changes not staged for commit:</span> |
| <span class="go"> (use "git add <file>..." to update what will be committed)</span> |
| <span class="go"> (use "git restore <file>..." to discard changes in working directory)</span> |
| <span class="go"> modified: R/expression.R</span> |
| <span class="go"> modified: tests/testthat/test-dplyr-funcs-datetime.R</span> |
| </pre></div> |
| </div> |
| <p>And <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">diff</span></code> to see the changes in the files in order to spot any error we might have made.</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>diff |
| <span class="go">diff --git a/r/R/expression.R b/r/R/expression.R</span> |
| <span class="go">index 37fc21c25..0e71803ec 100644</span> |
| <span class="go">--- a/r/R/expression.R</span> |
| <span class="go">+++ b/r/R/expression.R</span> |
| <span class="go">@@ -70,6 +70,7 @@</span> |
| <span class="go"> "quarter" = "quarter",</span> |
| <span class="gp"> # </span>second<span class="w"> </span>is<span class="w"> </span>defined<span class="w"> </span><span class="k">in</span><span class="w"> </span>dplyr-functions.R |
| <span class="gp"> # </span>wday<span class="w"> </span>is<span class="w"> </span>defined<span class="w"> </span><span class="k">in</span><span class="w"> </span>dplyr-functions.R |
| <span class="go">+ "mday" = "day",</span> |
| <span class="go"> "yday" = "day_of_year",</span> |
| <span class="go"> "year" = "year",</span> |
| |
| <span class="go">diff --git a/r/tests/testthat/test-dplyr-funcs-datetime.R b/r/tests/testthat/test-dplyr-funcs-datetime.R</span> |
| <span class="go">index 359a5403a..228eca56a 100644</span> |
| <span class="go">--- a/r/tests/testthat/test-dplyr-funcs-datetime.R</span> |
| <span class="go">+++ b/r/tests/testthat/test-dplyr-funcs-datetime.R</span> |
| <span class="go">@@ -444,6 +444,15 @@ test_that("extract wday from timestamp", {</span> |
| <span class="go"> )</span> |
| <span class="go"> })</span> |
| |
| <span class="go">+test_that("extract mday from timestamp", {</span> |
| <span class="go">+ compare_dplyr_binding(</span> |
| <span class="go">+ .input %>%</span> |
| <span class="go">+ mutate(x = mday(datetime)) %>%</span> |
| <span class="go">+ collect(),</span> |
| <span class="go">+ test_df</span> |
| <span class="go">+ )</span> |
| <span class="go">+})</span> |
| <span class="go">+</span> |
| <span class="go"> test_that("extract yday from timestamp", {</span> |
| <span class="go"> compare_dplyr_binding(</span> |
| <span class="go"> .input %>%</span> |
| <span class="go">@@ -626,6 +635,15 @@ test_that("extract wday from date", {</span> |
| <span class="go"> )</span> |
| <span class="go"> })</span> |
| |
| <span class="go">+test_that("extract mday from date", {</span> |
| <span class="go">+ compare_dplyr_binding(</span> |
| <span class="go">+ .input %>%</span> |
| <span class="go">+ mutate(x = mday(date)) %>%</span> |
| <span class="go">+ collect(),</span> |
| <span class="go">+ test_df</span> |
| <span class="go">+ )</span> |
| <span class="go">+})</span> |
| <span class="go">+</span> |
| <span class="go"> test_that("extract yday from date", {</span> |
| <span class="go"> compare_dplyr_binding(</span> |
| <span class="go"> .input %>%</span> |
| </pre></div> |
| </div> |
| <p>Everything looks OK. Now we can make the commit |
| (save our changes to the branch history):</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>commit<span class="w"> </span>-am<span class="w"> </span><span class="s2">"Adding a binding and a test for mday() lubridate"</span> |
| <span class="go">[ARROW-14816 ed37d3a3b] Adding a binding and a test for mday() lubridate</span> |
| <span class="go"> 2 files changed, 19 insertions(+)</span> |
| </pre></div> |
| </div> |
| <p>We can use <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">log</span></code> to check the history of commits:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>log |
| <span class="go">commit ed37d3a3b3eef76b696532f10562fea85f809fab (HEAD -> ARROW-14816)</span> |
| <span class="go">Author: Alenka Frim <frim.alenka@gmail.com></span> |
| <span class="go">Date: Fri Jan 21 09:15:31 2022 +0100</span> |
| |
| <span class="go"> Adding a binding and a test for mday() lubridate</span> |
| |
| <span class="go">commit c5358787ee8f7b80f067292f49e5f032854041b9 (upstream/main, upstream/HEAD, main, ARROW-15346, ARROW-10643)</span> |
| <span class="go">Author: Krisztián Szűcs <szucs.krisztian@gmail.com></span> |
| <span class="go">Date: Thu Jan 20 09:45:59 2022 +0900</span> |
| |
| <span class="go"> ARROW-15372: [C++][Gandiva] Gandiva now depends on boost/crc.hpp which is missing from the trimmed boost archive</span> |
| |
| <span class="go"> See build error https://github.com/ursacomputing/crossbow/runs/4871392838?check_suite_focus=true#step:5:11762</span> |
| |
| <span class="go"> Closes #12190 from kszucs/ARROW-15372</span> |
| |
| <span class="go"> Authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com></span> |
| <span class="go"> Signed-off-by: Sutou Kouhei <kou@clear-code.com></span> |
| </pre></div> |
| </div> |
| <p>If we started the branch some time ago, we may need to rebase |
| to upstream main to make sure there are no merge conflicts:</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>pull<span class="w"> </span>upstream<span class="w"> </span>main<span class="w"> </span>--rebase |
| </pre></div> |
| </div> |
| <p>And now we can push our work to the forked Arrow repository |
| on GitHub called origin.</p> |
| <div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>push<span class="w"> </span>origin<span class="w"> </span>ARROW-14816 |
| <span class="go">Enumerating objects: 233, done.</span> |
| <span class="go">Counting objects: 100% (233/233), done.</span> |
| <span class="go">Delta compression using up to 8 threads</span> |
| <span class="go">Compressing objects: 100% (130/130), done.</span> |
| <span class="go">Writing objects: 100% (151/151), 35.78 KiB | 8.95 MiB/s, done.</span> |
| <span class="go">Total 151 (delta 129), reused 33 (delta 20), pack-reused 0</span> |
| <span class="go">remote: Resolving deltas: 100% (129/129), completed with 80 local objects.</span> |
| <span class="go">remote:</span> |
| <span class="go">remote: Create a pull request for 'ARROW-14816' on GitHub by visiting:</span> |
| <span class="go">remote: https://github.com/AlenkaF/arrow/pull/new/ARROW-14816</span> |
| <span class="go">remote:</span> |
| <span class="go">To https://github.com/AlenkaF/arrow.git</span> |
| <span class="go"> * [new branch] ARROW-14816 -> ARROW-14816</span> |
| </pre></div> |
| </div> |
| <p>Now we have to go to the <a class="reference external" href="https://github.com/apache/arrow">Arrow repository on GitHub</a> |
| to create a Pull Request. On the GitHub Arrow |
| page (main or forked) we will see a yellow notice |
| bar with a note that we made recent pushes to the branch |
| ARROW-14816. That’s great, now we can make the Pull Request |
| by clicking on <strong>Compare & pull request</strong>.</p> |
| <figure class="align-default" id="id1"> |
| <a class="reference internal image-reference" href="../../../_images/R_tutorial_create_pr_notice.jpeg"><img alt="GitHub page of the Apache Arrow repository showing a notice bar indicating change has been made in our branch and a Pull Request can be created." src="../../../_images/R_tutorial_create_pr_notice.jpeg" style="width: 835.1999999999999px; height: 510.0px;" /> |
| </a> |
| <figcaption> |
| <p><span class="caption-text">Notice bar on the Apache Arrow repository.</span><a class="headerlink" href="#id1" title="Link to this image">#</a></p> |
| </figcaption> |
| </figure> |
| <p>First we need to change the Title to <strong>ARROW-14816: [R] Implement |
| bindings for lubridate::mday()</strong> in order to match it with the |
| issue. Note a punctuation mark was added!</p> |
| <p><em>Extra note: when this tutorial was created, we had been using the Jira issue |
| tracker. As we are currently using GitHub issues, the title would be prefixed |
| with GH-14816: [R] Implement bindings for lubridate::mday()</em>.</p> |
| <p>We will also add a description to make it clear to others what we are trying to do.</p> |
| <figure class="align-default" id="id2"> |
| <a class="reference internal image-reference" href="../../../_images/R_tutorial_pr_descr.jpeg"><img alt="GitHub page of the Pull Request showing the editor for the title and a description." src="../../../_images/R_tutorial_pr_descr.jpeg" style="width: 785.5px; height: 852.0px;" /> |
| </a> |
| <figcaption> |
| <p><span class="caption-text">Editing the title and the description of our Pull Request.</span><a class="headerlink" href="#id2" title="Link to this image">#</a></p> |
| </figcaption> |
| </figure> |
| <p>Once we click <strong>Create pull request</strong> our code can be reviewed as |
| a Pull Request in the Apache Arrow repository.</p> |
| <figure class="align-default" id="id3"> |
| <a class="reference internal image-reference" href="../../../_images/R_tutorial_pr.jpeg"><img alt="GitHub page of the Pull Request showing the title and a description." src="../../../_images/R_tutorial_pr.jpeg" style="width: 785.5px; height: 852.0px;" /> |
| </a> |
| <figcaption> |
| <p><span class="caption-text">Here it is, our Pull Request!</span><a class="headerlink" href="#id3" title="Link to this image">#</a></p> |
| </figcaption> |
| </figure> |
| <p>The pull request gets connected to the issue and the CI is running. |
| After some time passes and we get a review we can correct the code, |
| comment, resolve conversations and so on.</p> |
| <div class="admonition seealso"> |
| <p class="admonition-title">See also</p> |
| <p>For more information about Pull Request workflow see <a class="reference internal" href="../step_by_step/pr_lifecycle.html#pr-lifecycle"><span class="std std-ref">Lifecycle of a pull request</span></a>.</p> |
| </div> |
| <p>The Pull Request we made can be viewed <a class="reference external" href="https://github.com/apache/arrow/pull/12218">here</a>.</p> |
| </section> |
| </section> |
| </section> |
| |
| |
| </article> |
| |
| |
| |
| |
| |
| <footer class="prev-next-footer d-print-none"> |
| |
| <div class="prev-next-area"> |
| <a class="left-prev" |
| href="python_tutorial.html" |
| title="previous page"> |
| <i class="fa-solid fa-angle-left"></i> |
| <div class="prev-next-info"> |
| <p class="prev-next-subtitle">previous</p> |
| <p class="prev-next-title">Python tutorial</p> |
| </div> |
| </a> |
| <a class="right-next" |
| href="../resources.html" |
| title="next page"> |
| <div class="prev-next-info"> |
| <p class="prev-next-subtitle">next</p> |
| <p class="prev-next-title">Additional information and resources</p> |
| </div> |
| <i class="fa-solid fa-angle-right"></i> |
| </a> |
| </div> |
| </footer> |
| |
| </div> |
| |
| |
| |
| <dialog id="pst-secondary-sidebar-modal"></dialog> |
| <div id="pst-secondary-sidebar" class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner"> |
| |
| |
| <div class="sidebar-secondary-item"> |
| <div |
| id="pst-page-navigation-heading-2" |
| class="page-toc tocsection onthispage"> |
| <i class="fa-solid fa-list"></i> On this page |
| </div> |
| <nav class="bd-toc-nav page-toc" aria-labelledby="pst-page-navigation-heading-2"> |
| <ul class="visible nav section-nav flex-column"> |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#r-tutorial-on-adding-a-lubridate-binding">R tutorial on adding a lubridate binding</a><ul class="visible nav section-nav flex-column"> |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#set-up">Set up</a></li> |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#building-r-package">Building R package</a></li> |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#the-issue">The issue</a></li> |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#start-the-work-on-a-new-branch">Start the work on a new branch</a></li> |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#adding-a-test">Adding a test</a></li> |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#check-styling">Check styling</a></li> |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#creating-a-pull-request">Creating a Pull Request</a></li> |
| </ul> |
| </li> |
| </ul> |
| </nav></div> |
| |
| <div class="sidebar-secondary-item"> |
| |
| |
| <div class="tocsection editthispage"> |
| <a href="https://github.com/apache/arrow/edit/main/docs/source/developers/guide/tutorials/r_tutorial.rst"> |
| <i class="fa-solid fa-pencil"></i> |
| |
| |
| |
| Edit on GitHub |
| |
| |
| </a> |
| </div> |
| </div> |
| |
| </div></div> |
| |
| |
| </div> |
| <footer class="bd-footer-content"> |
| |
| </footer> |
| |
| </main> |
| </div> |
| </div> |
| |
| <!-- Scripts loaded after <body> so the DOM is not blocked --> |
| <script defer src="../../../_static/scripts/bootstrap.js?digest=8878045cc6db502f8baf"></script> |
| <script defer src="../../../_static/scripts/pydata-sphinx-theme.js?digest=8878045cc6db502f8baf"></script> |
| |
| <footer class="bd-footer"> |
| <div class="bd-footer__inner bd-page-width"> |
| |
| <div class="footer-items__start"> |
| |
| <div class="footer-item"> |
| |
| <p class="copyright"> |
| |
| © Copyright 2016-2025 Apache Software Foundation. |
| Apache Arrow, Arrow, Apache, the Apache logo, and the Apache Arrow project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries. |
| <br/> |
| |
| </p> |
| </div> |
| |
| <div class="footer-item"> |
| |
| <p class="sphinx-version"> |
| Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3. |
| <br/> |
| </p> |
| </div> |
| |
| </div> |
| |
| |
| |
| <div class="footer-items__end"> |
| |
| <div class="footer-item"> |
| <p class="theme-version"> |
| <!-- # L10n: Setting the PST URL as an argument as this does not need to be localized --> |
| Built with the <a href="https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html">PyData Sphinx Theme</a> 0.16.1. |
| </p></div> |
| |
| </div> |
| |
| </div> |
| |
| </footer> |
| </body> |
| </html> |