<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to display Sparklyr table in a clean readable format similar to the output of display()? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-display-sparklyr-table-in-a-clean-readable-format-similar/m-p/25294#M17575</link>
    <description>&lt;P&gt;There exist a Databricks’s built-in display() function (see documentation&amp;nbsp;&lt;A href="https://databricks.com/blog/2015/07/13/introducing-r-notebooks-in-databricks.html" alt="https://databricks.com/blog/2015/07/13/introducing-r-notebooks-in-databricks.html" target="_blank"&gt;here&lt;/A&gt;) which allow users to display R or SparkR dataframe in a clean and human readable manner where user can scroll to see all the columns and perform sorting on the columns. See image below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="ewFTT.jpg"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2003i995AE77FABE66C3E/image-size/large?v=v2&amp;amp;px=999" role="button" title="ewFTT.jpg" alt="ewFTT.jpg" /&gt;&lt;/span&gt;Is there a way to display tables that are output from sparklyr in such a manner in Databricks? Obviously I am not able to use function directly on the sparklyr table hence I attempted to convert the sparklyr table into a R dataframe before using display() function but was hit with&amp;nbsp;&lt;I&gt;java.lang.IllegalArgumentException: Invalid type N&lt;/I&gt;&amp;nbsp;error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="h3hff"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2006i237510F3DF7612A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="h3hff" alt="h3hff" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Mar 2022 14:40:11 GMT</pubDate>
    <dc:creator>SG_</dc:creator>
    <dc:date>2022-03-17T14:40:11Z</dc:date>
    <item>
      <title>How to display Sparklyr table in a clean readable format similar to the output of display()?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-display-sparklyr-table-in-a-clean-readable-format-similar/m-p/25294#M17575</link>
      <description>&lt;P&gt;There exist a Databricks’s built-in display() function (see documentation&amp;nbsp;&lt;A href="https://databricks.com/blog/2015/07/13/introducing-r-notebooks-in-databricks.html" alt="https://databricks.com/blog/2015/07/13/introducing-r-notebooks-in-databricks.html" target="_blank"&gt;here&lt;/A&gt;) which allow users to display R or SparkR dataframe in a clean and human readable manner where user can scroll to see all the columns and perform sorting on the columns. See image below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="ewFTT.jpg"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2003i995AE77FABE66C3E/image-size/large?v=v2&amp;amp;px=999" role="button" title="ewFTT.jpg" alt="ewFTT.jpg" /&gt;&lt;/span&gt;Is there a way to display tables that are output from sparklyr in such a manner in Databricks? Obviously I am not able to use function directly on the sparklyr table hence I attempted to convert the sparklyr table into a R dataframe before using display() function but was hit with&amp;nbsp;&lt;I&gt;java.lang.IllegalArgumentException: Invalid type N&lt;/I&gt;&amp;nbsp;error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="h3hff"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2006i237510F3DF7612A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="h3hff" alt="h3hff" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 14:40:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-display-sparklyr-table-in-a-clean-readable-format-similar/m-p/25294#M17575</guid>
      <dc:creator>SG_</dc:creator>
      <dc:date>2022-03-17T14:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Sparklyr table in a clean readable format similar to the output of display()?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-display-sparklyr-table-in-a-clean-readable-format-similar/m-p/25295#M17576</link>
      <description>&lt;P&gt;I found that the display() function returned this issue when it came across date-type fields that were NULL.  The following function seemed to fix the problem:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;library(tidyverse)
library(lubridate)
&amp;nbsp;
display_fixed = function(df) {
    df %&amp;gt;% 
        mutate( across( where(is.instant), ~if_else( is.na(.x), as_datetime("1900-01-01"), as_datetime(.x)) ) ) %&amp;gt;% 
        display()
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Try the following in your test example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;dat2 %&amp;gt;% collect(n=10) %&amp;gt;% display_fixed()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 19:47:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-display-sparklyr-table-in-a-clean-readable-format-similar/m-p/25295#M17576</guid>
      <dc:creator>rich_goldberg</dc:creator>
      <dc:date>2023-02-21T19:47:52Z</dc:date>
    </item>
  </channel>
</rss>

