@@ -55,7 +55,12 @@ csv_read_options <- function(use_threads = TRUE, block_size = 1048576L) {
55
55
# ' @param header_rows Number of header rows to skip (including the first row containing column names)
56
56
# '
57
57
# ' @export
58
- csv_parse_options <- function (delimiter = " ," , quoting = TRUE , quote_char = ' "' , double_quote = TRUE , escaping = FALSE , escape_char = ' \\ ' , newlines_in_values = FALSE , ignore_empty_lines = TRUE , header_rows = 1L ){
58
+ csv_parse_options <- function (
59
+ delimiter = " ," , quoting = TRUE , quote_char = ' "' ,
60
+ double_quote = TRUE , escaping = FALSE , escape_char = ' \\ ' ,
61
+ newlines_in_values = FALSE , ignore_empty_lines = TRUE ,
62
+ header_rows = 1L
63
+ ){
59
64
shared_ptr(`arrow::csv::ParseOptions` , csv___ParseOptions__initialize(
60
65
list (
61
66
delimiter = delimiter ,
@@ -93,34 +98,77 @@ csv_convert_options <- function(check_utf8 = TRUE){
93
98
# ' @param ... additional parameters.
94
99
# '
95
100
# ' @export
96
- csv_table_reader <- function (file , read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ... ){
101
+ csv_table_reader <- function (file ,
102
+ read_options = csv_read_options(),
103
+ parse_options = csv_parse_options(),
104
+ convert_options = csv_convert_options(),
105
+ ...
106
+ ){
97
107
UseMethod(" csv_table_reader" )
98
108
}
99
109
100
110
# ' @importFrom rlang abort
101
111
# ' @export
102
- csv_table_reader.default <- function (file , read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ... ) {
112
+ csv_table_reader.default <- function (file ,
113
+ read_options = csv_read_options(),
114
+ parse_options = csv_parse_options(),
115
+ convert_options = csv_convert_options(),
116
+ ...
117
+ ) {
103
118
abort(" unsupported" )
104
119
}
105
120
106
121
# ' @export
107
- `csv_table_reader.character` <- function (file , read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ... ){
108
- csv_table_reader(fs :: path_abs(file ), read_options = read_options , parse_options = parse_options , convert_options = convert_options , ... )
122
+ `csv_table_reader.character` <- function (file ,
123
+ read_options = csv_read_options(),
124
+ parse_options = csv_parse_options(),
125
+ convert_options = csv_convert_options(),
126
+ ...
127
+ ){
128
+ csv_table_reader(fs :: path_abs(file ),
129
+ read_options = read_options ,
130
+ parse_options = parse_options ,
131
+ convert_options = convert_options ,
132
+ ...
133
+ )
109
134
}
110
135
111
136
# ' @export
112
- `csv_table_reader.fs_path` <- function (file , read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), mmap = TRUE , ... ){
137
+ `csv_table_reader.fs_path` <- function (file ,
138
+ read_options = csv_read_options(),
139
+ parse_options = csv_parse_options(),
140
+ convert_options = csv_convert_options(),
141
+ mmap = TRUE ,
142
+ ...
143
+ ){
113
144
stream <- if (isTRUE(mmap )) mmap_open(file ) else file_open(file )
114
- csv_table_reader(stream , read_options = read_options , parse_options = parse_options , convert_options = convert_options , ... )
145
+ csv_table_reader(stream ,
146
+ read_options = read_options ,
147
+ parse_options = parse_options ,
148
+ convert_options = convert_options ,
149
+ ...
150
+ )
115
151
}
116
152
117
153
# ' @export
118
- `csv_table_reader.arrow::io::InputStream` <- function (file , read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ... ){
119
- shared_ptr(`arrow::csv::TableReader` , csv___TableReader__Make(file , read_options , parse_options , convert_options ))
154
+ `csv_table_reader.arrow::io::InputStream` <- function (file ,
155
+ read_options = csv_read_options(),
156
+ parse_options = csv_parse_options(),
157
+ convert_options = csv_convert_options(),
158
+ ...
159
+ ){
160
+ shared_ptr(`arrow::csv::TableReader` ,
161
+ csv___TableReader__Make(file , read_options , parse_options , convert_options )
162
+ )
120
163
}
121
164
122
165
# ' @export
123
- `csv_table_reader.arrow::csv::TableReader` <- function (file , read_options = csv_read_options(), parse_options = csv_parse_options(), convert_options = csv_convert_options(), ... ){
166
+ `csv_table_reader.arrow::csv::TableReader` <- function (file ,
167
+ read_options = csv_read_options(),
168
+ parse_options = csv_parse_options(),
169
+ convert_options = csv_convert_options(),
170
+ ...
171
+ ){
124
172
file
125
173
}
126
174
0 commit comments