ACSVFileFormat is aFileFormat subclass which holds information about how toread and parse the files included in a CSVDataset.
Factory
CSVFileFormat$create() can take options in the form of lists passed through asparse_options,read_options, orconvert_options parameters. Alternatively, readr-style options can be passedthrough individually. While it is possible to pass inCSVReadOptions,CSVConvertOptions, andCSVParseOptionsobjects, this is not recommended as options set in these objects are not validated for compatibility.
Examples
# Set up directory for examplestf<-tempfile()dir.create(tf)on.exit(unlink(tf))df<-data.frame(x=c("1","2","NULL"))write.table(df,file.path(tf,"file1.txt"), sep=",", row.names=FALSE)# Create CsvFileFormat object with Arrow-style null_values optionformat<-CsvFileFormat$create(convert_options=list(null_values=c("","NA","NULL")))open_dataset(tf, format=format)#> FileSystemDataset with 1 csv file#> 1 columns#> x: int64# Use readr-style optionsformat<-CsvFileFormat$create(na=c("","NA","NULL"))open_dataset(tf, format=format)#> FileSystemDataset with 1 csv file#> 1 columns#> x: int64