stephhazlitt opened a new issue, #37594:
URL: https://github.com/apache/arrow/issues/37594

   ### Describe the enhancement requested
   
   I wonder if a convenience function for returning the schema code would be 
handy for users? 
   
   Currently you can extract the schema with:
   
   ``` r
   library(arrow)
   #> 
   #> Attaching package: 'arrow'
   #> The following object is masked from 'package:utils':
   #> 
   #>     timestamp
   library(dplyr)
   #> 
   #> Attaching package: 'dplyr'
   #> The following objects are masked from 'package:stats':
   #> 
   #>     filter, lag
   #> The following objects are masked from 'package:base':
   #> 
   #>     intersect, setdiff, setequal, union
   
   schema(arrow_table(mtcars))
   #> Schema
   #> mpg: double
   #> cyl: double
   #> disp: double
   #> hp: double
   #> drat: double
   #> wt: double
   #> qsec: double
   #> vs: double
   #> am: double
   #> gear: double
   #> carb: double
   #> 
   #> See $metadata for additional Schema metadata
   ```
   And you can extract the schema code with:
   
   ``` r
   library(arrow)
   #> 
   #> Attaching package: 'arrow'
   #> The following object is masked from 'package:utils':
   #> 
   #>     timestamp
   library(dplyr)
   #> 
   #> Attaching package: 'dplyr'
   #> The following objects are masked from 'package:stats':
   #> 
   #>     filter, lag
   #> The following objects are masked from 'package:base':
   #> 
   #>     intersect, setdiff, setequal, union
   
   arrow_table(mtcars)$schema$code()
   #> schema(mpg = float64(), cyl = float64(), disp = float64(), hp = 
float64(), 
   #>     drat = float64(), wt = float64(), qsec = float64(), vs = float64(), 
   #>     am = float64(), gear = float64(), carb = float64())
   ```
   
   The schema code output is very useful for editing/altering and creating 
schemas, but the code is not very intuitive, especially for new users. I was 
thinking maybe a `schema_code()` convenience function might be useful (or some 
other better suited name).
   
   ### Component(s)
   
   R


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to