Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ save(Stream(format"CSV", io), it)

The ``save`` function takes a number of arguments:
````julia
save(f::FileIO.File{FileIO.format"CSV"}, data; delim=',', quotechar='"', escapechar='"', nastring="NA", header=true)
save(f::FileIO.File{FileIO.format"CSV"}, data; delim=',', quotechar='"', escapechar='"', nastring="", header=true)
````

#### Arguments
Expand Down
16 changes: 8 additions & 8 deletions src/csv_writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
end
end

function _save(io, data; delim=',', quotechar='"', escapechar='"', nastring="NA", header=true)
function _save(io, data; delim=',', quotechar='"', escapechar='"', nastring="", header=true)
isiterabletable(data) || error("Can't write this data to a CSV file.")

it = getiterator(data)
Expand All @@ -62,7 +62,7 @@ function _save(io, data; delim=',', quotechar='"', escapechar='"', nastring="NA"
_writecsv(io, it, eltype(it), delim, quotechar, escapechar, nastring)
end

function _save(filename::AbstractString, data; delim=',', quotechar='"', escapechar='"', nastring="NA", header=true)
function _save(filename::AbstractString, data; delim=',', quotechar='"', escapechar='"', nastring="", header=true)
isiterabletable(data) || error("Can't write this data to a CSV file.")

ext = last(split(filename, '.'))
Expand All @@ -80,19 +80,19 @@ end



function fileio_save(f::FileIO.File{FileIO.format"CSV"}, data; delim=',', quotechar='"', escapechar='"', nastring="NA", header=true)
function fileio_save(f::FileIO.File{FileIO.format"CSV"}, data; delim=',', quotechar='"', escapechar='"', nastring="", header=true)
return _save(f.filename, data, delim=delim, quotechar=quotechar, escapechar=escapechar, nastring=nastring, header=header)
end

function fileio_save(f::FileIO.File{FileIO.format"TSV"}, data; delim='\t', quotechar='"', escapechar='"', nastring="NA", header=true)
function fileio_save(f::FileIO.File{FileIO.format"TSV"}, data; delim='\t', quotechar='"', escapechar='"', nastring="", header=true)
return _save(f.filename, data, delim=delim, quotechar=quotechar, escapechar=escapechar, nastring=nastring, header=header)
end

function fileio_save(s::FileIO.Stream{FileIO.format"CSV"}, data; delim=',', quotechar='"', escapechar='"', nastring="NA", header=true)
function fileio_save(s::FileIO.Stream{FileIO.format"CSV"}, data; delim=',', quotechar='"', escapechar='"', nastring="", header=true)
return _save(s.io, data, delim=delim, quotechar=quotechar, escapechar=escapechar, nastring=nastring, header=header)
end

function fileio_save(s::FileIO.Stream{FileIO.format"TSV"}, data; delim='\t', quotechar='"', escapechar='"', nastring="NA", header=true)
function fileio_save(s::FileIO.Stream{FileIO.format"TSV"}, data; delim='\t', quotechar='"', escapechar='"', nastring="", header=true)
return _save(s.io, data, delim=delim, quotechar=quotechar, escapechar=escapechar, nastring=nastring, header=header)
end

Expand All @@ -113,7 +113,7 @@ mutable struct CSVFileSaveStream{T}
header::Bool
end

function fileio_savestreaming(f::FileIO.File{T}, data=nothing; delim=_delim(T), quotechar='"', escapechar='"', nastring="NA",
function fileio_savestreaming(f::FileIO.File{T}, data=nothing; delim=_delim(T), quotechar='"', escapechar='"', nastring="",
header=true) where T <: CSV_or_TSV
io = open(f.filename, "w")

Expand All @@ -124,7 +124,7 @@ function fileio_savestreaming(f::FileIO.File{T}, data=nothing; delim=_delim(T),
return CSVFileSaveStream(io, data!==nothing, delim, quotechar, escapechar, nastring, header)
end

function fileio_savestreaming(s::FileIO.Stream{T}, data=nothing; delim=_delim(T), quotechar='"', escapechar='"', nastring="NA",
function fileio_savestreaming(s::FileIO.Stream{T}, data=nothing; delim=_delim(T), quotechar='"', escapechar='"', nastring="",
header=false) where T <: CSV_or_TSV

if data!==nothing
Expand Down