@@ -46,16 +46,13 @@ DataType <- R6Class(
4646 DataType__ToString(self )
4747 },
4848 Equals = function (other , check_metadata = FALSE , ... ) {
49- inherits(other , " DataType" ) &&
50- DataType__Equals(self , other , isTRUE(check_metadata ))
49+ inherits(other , " DataType" ) && DataType__Equals(self , other , isTRUE(check_metadata ))
5150 },
5251 fields = function () {
5352 DataType__fields(self )
5453 },
5554 export_to_c = function (ptr ) ExportType(self , ptr ),
56- code = function (namespace = FALSE ) {
57- call(" stop" , paste0(" Unsupported type: <" , self $ ToString(), " >." ))
58- }
55+ code = function (namespace = FALSE ) call(" stop" , paste0(" Unsupported type: <" , self $ ToString(), " >." ))
5956 ),
6057 active = list (
6158 id = function () DataType__id(self ),
@@ -68,14 +65,7 @@ DataType <- R6Class(
6865DataType $ import_from_c <- ImportType
6966
7067INTEGER_TYPES <- as.character(outer(c(" uint" , " int" ), c(8 , 16 , 32 , 64 ), paste0 ))
71- FLOAT_TYPES <- c(
72- " float16" ,
73- " float32" ,
74- " float64" ,
75- " halffloat" ,
76- " float" ,
77- " double"
78- )
68+ FLOAT_TYPES <- c(" float16" , " float32" , " float64" , " halffloat" , " float" , " double" )
7969
8070# ' Infer the arrow Array type from an R object
8171# '
@@ -181,9 +171,7 @@ FixedWidthType <- R6Class(
181171 " FixedWidthType" ,
182172 inherit = DataType ,
183173 public = list (
184- code = function (namespace = FALSE ) {
185- call2(tolower(self $ name ), .ns = if (namespace ) " arrow" )
186- }
174+ code = function (namespace = FALSE ) call2(tolower(self $ name ), .ns = if (namespace ) " arrow" )
187175 ),
188176 active = list (
189177 bit_width = function () FixedWidthType__bit_width(self )
@@ -204,64 +192,50 @@ Float64 <- R6Class(
204192 " Float64" ,
205193 inherit = FixedWidthType ,
206194 public = list (
207- code = function (namespace = FALSE ) {
208- call2(" float64" , .ns = if (namespace ) " arrow" )
209- }
195+ code = function (namespace = FALSE ) call2(" float64" , .ns = if (namespace ) " arrow" )
210196 )
211197)
212198Boolean <- R6Class(" Boolean" , inherit = FixedWidthType )
213199Utf8 <- R6Class(
214200 " Utf8" ,
215201 inherit = DataType ,
216202 public = list (
217- code = function (namespace = FALSE ) {
218- call2(" utf8" , .ns = if (namespace ) " arrow" )
219- }
203+ code = function (namespace = FALSE ) call2(" utf8" , .ns = if (namespace ) " arrow" )
220204 )
221205)
222206Utf8View <- R6Class(
223207 " Utf8View" ,
224208 inherit = DataType ,
225209 public = list (
226- code = function (namespace = FALSE ) {
227- call2(" utf8_view" , .ns = if (namespace ) " arrow" )
228- }
210+ code = function (namespace = FALSE ) call2(" utf8_view" , .ns = if (namespace ) " arrow" )
229211 )
230212)
231213LargeUtf8 <- R6Class(
232214 " LargeUtf8" ,
233215 inherit = DataType ,
234216 public = list (
235- code = function (namespace = FALSE ) {
236- call2(" large_utf8" , .ns = if (namespace ) " arrow" )
237- }
217+ code = function (namespace = FALSE ) call2(" large_utf8" , .ns = if (namespace ) " arrow" )
238218 )
239219)
240220Binary <- R6Class(
241221 " Binary" ,
242222 inherit = DataType ,
243223 public = list (
244- code = function (namespace = FALSE ) {
245- call2(" binary" , .ns = if (namespace ) " arrow" )
246- }
224+ code = function (namespace = FALSE ) call2(" binary" , .ns = if (namespace ) " arrow" )
247225 )
248226)
249227LargeBinary <- R6Class(
250228 " LargeBinary" ,
251229 inherit = DataType ,
252230 public = list (
253- code = function (namespace = FALSE ) {
254- call2(" large_binary" , .ns = if (namespace ) " arrow" )
255- }
231+ code = function (namespace = FALSE ) call2(" large_binary" , .ns = if (namespace ) " arrow" )
256232 )
257233)
258234BinaryView <- R6Class(
259235 " BinaryView" ,
260236 inherit = DataType ,
261237 public = list (
262- code = function (namespace = FALSE ) {
263- call2(" binary_view" , .ns = if (namespace ) " arrow" )
264- }
238+ code = function (namespace = FALSE ) call2(" binary_view" , .ns = if (namespace ) " arrow" )
265239 )
266240)
267241FixedSizeBinary <- R6Class(
@@ -270,11 +244,7 @@ FixedSizeBinary <- R6Class(
270244 public = list (
271245 byte_width = function () FixedSizeBinary__byte_width(self ),
272246 code = function (namespace = FALSE ) {
273- call2(
274- " fixed_size_binary" ,
275- byte_width = self $ byte_width(),
276- .ns = if (namespace ) " arrow"
277- )
247+ call2(" fixed_size_binary" , byte_width = self $ byte_width(), .ns = if (namespace ) " arrow" )
278248 }
279249 )
280250)
@@ -283,9 +253,7 @@ DateType <- R6Class(
283253 " DateType" ,
284254 inherit = FixedWidthType ,
285255 public = list (
286- code = function (namespace = FALSE ) {
287- call2(tolower(self $ name ), .ns = if (namespace ) " arrow" )
288- },
256+ code = function (namespace = FALSE ) call2(tolower(self $ name ), .ns = if (namespace ) " arrow" ),
289257 unit = function () DateType__unit(self )
290258 )
291259)
@@ -340,9 +308,7 @@ Null <- R6Class(
340308 " Null" ,
341309 inherit = DataType ,
342310 public = list (
343- code = function (namespace = FALSE ) {
344- call2(" null" , .ns = if (namespace ) " arrow" )
345- }
311+ code = function (namespace = FALSE ) call2(" null" , .ns = if (namespace ) " arrow" )
346312 )
347313)
348314
@@ -356,12 +322,7 @@ Timestamp <- R6Class(
356322 if (identical(tz , " " )) {
357323 call2(" timestamp" , unit = unit , .ns = if (namespace ) " arrow" )
358324 } else {
359- call2(
360- " timestamp" ,
361- unit = unit ,
362- timezone = tz ,
363- .ns = if (namespace ) " arrow"
364- )
325+ call2(" timestamp" , unit = unit , timezone = tz , .ns = if (namespace ) " arrow" )
365326 }
366327 },
367328 timezone = function () TimestampType__timezone(self ),
@@ -374,12 +335,7 @@ DecimalType <- R6Class(
374335 inherit = FixedWidthType ,
375336 public = list (
376337 code = function (namespace = FALSE ) {
377- call2(
378- " decimal" ,
379- precision = self $ precision(),
380- scale = self $ scale(),
381- .ns = if (namespace ) " arrow"
382- )
338+ call2(" decimal" , precision = self $ precision(), scale = self $ scale(), .ns = if (namespace ) " arrow" )
383339 },
384340 precision = function () DecimalType__precision(self ),
385341 scale = function () DecimalType__scale(self )
@@ -589,9 +545,7 @@ binary_view <- function() BinaryView__initialize()
589545
590546# ' @rdname data-type
591547# ' @export
592- fixed_size_binary <- function (byte_width ) {
593- FixedSizeBinary__initialize(byte_width )
594- }
548+ fixed_size_binary <- function (byte_width ) FixedSizeBinary__initialize(byte_width )
595549
596550# ' @rdname data-type
597551# ' @export
@@ -640,18 +594,10 @@ make_valid_time_unit <- function(unit, valid_units) {
640594 # Allow non-integer input for convenience
641595 unit <- as.integer(unit )
642596 } else {
643- stop(
644- ' "unit" should be one of ' ,
645- oxford_paste(names(valid_units ), " or" ),
646- call. = FALSE
647- )
597+ stop(' "unit" should be one of ' , oxford_paste(names(valid_units ), " or" ), call. = FALSE )
648598 }
649599 if (! (unit %in% valid_units )) {
650- stop(
651- ' "unit" should be one of ' ,
652- oxford_paste(valid_units , " or" ),
653- call. = FALSE
654- )
600+ stop(' "unit" should be one of ' , oxford_paste(valid_units , " or" ), call. = FALSE )
655601 }
656602 unit
657603}
@@ -774,11 +720,7 @@ ListType <- R6Class(
774720 inherit = NestedType ,
775721 public = list (
776722 code = function (namespace = FALSE ) {
777- call2(
778- " list_of" ,
779- self $ value_type $ code(namespace ),
780- .ns = if (namespace ) " arrow"
781- )
723+ call2(" list_of" , self $ value_type $ code(namespace ), .ns = if (namespace ) " arrow" )
782724 }
783725 ),
784726 active = list (
@@ -796,11 +738,7 @@ LargeListType <- R6Class(
796738 inherit = NestedType ,
797739 public = list (
798740 code = function (namespace = FALSE ) {
799- call2(
800- " large_list_of" ,
801- self $ value_type $ code(namespace ),
802- .ns = if (namespace ) " arrow"
803- )
741+ call2(" large_list_of" , self $ value_type $ code(namespace ), .ns = if (namespace ) " arrow" )
804742 }
805743 ),
806744 active = list (
@@ -837,9 +775,7 @@ FixedSizeListType <- R6Class(
837775
838776# ' @rdname data-type
839777# ' @export
840- fixed_size_list_of <- function (type , list_size ) {
841- fixed_size_list__(type , list_size )
842- }
778+ fixed_size_list_of <- function (type , list_size ) fixed_size_list__(type , list_size )
843779
844780# ' @rdname data-type
845781# ' @export
@@ -857,9 +793,7 @@ MapType <- R6Class(
857793
858794# ' @rdname data-type
859795# ' @export
860- map_of <- function (key_type , item_type , .keys_sorted = FALSE ) {
861- map__(key_type , item_type , .keys_sorted )
862- }
796+ map_of <- function (key_type , item_type , .keys_sorted = FALSE ) map__(key_type , item_type , .keys_sorted )
863797
864798as_type <- function (type , name = " type" ) {
865799 # magic so we don't have to mask base::double()
@@ -877,10 +811,7 @@ canonical_type_str <- function(type_str) {
877811 # aliases to match the strings returned by DataType$ToString()
878812 assert_that(is.string(type_str ))
879813 if (grepl(" [([<]" , type_str )) {
880- stop(
881- " Cannot interpret string representations of data types that have parameters" ,
882- call. = FALSE
883- )
814+ stop(" Cannot interpret string representations of data types that have parameters" , call. = FALSE )
884815 }
885816 switch (
886817 type_str ,
0 commit comments