@@ -30,14 +30,79 @@ function countlines(io::IO, eol::Char='\n')
30
30
nl
31
31
end
32
32
33
+ """
34
+ readdlm(source, T::Type; options...)
35
+
36
+ The columns are assumed to be separated by one or more whitespaces. The end of line
37
+ delimiter is taken as `\\ n`.
38
+ """
33
39
readdlm (input, T:: Type ; opts... ) = readdlm (input, invalid_dlm (Char), T, ' \n ' ; opts... )
40
+
41
+ """
42
+ readdlm(source, delim::Char, T::Type; options...)
43
+
44
+ The end of line delimiter is taken as `\\ n`.
45
+ """
34
46
readdlm (input, dlm:: Char , T:: Type ; opts... ) = readdlm (input, dlm, T, ' \n ' ; opts... )
35
47
48
+ """
49
+ readdlm(source; options...)
50
+
51
+ The columns are assumed to be separated by one or more whitespaces. The end of line
52
+ delimiter is taken as `\\ n`. If all data is numeric, the result will be a numeric array. If
53
+ some elements cannot be parsed as numbers, a heterogeneous array of numbers and strings
54
+ is returned.
55
+ """
36
56
readdlm (input; opts... ) = readdlm (input, invalid_dlm (Char), ' \n ' ; opts... )
57
+
58
+ """
59
+ readdlm(source, delim::Char; options...)
60
+
61
+ The end of line delimiter is taken as `\\ n`. If all data is numeric, the result will be a
62
+ numeric array. If some elements cannot be parsed as numbers, a heterogeneous array of
63
+ numbers and strings is returned.
64
+ """
37
65
readdlm (input, dlm:: Char ; opts... ) = readdlm (input, dlm, ' \n ' ; opts... )
38
66
67
+ """
68
+ readdlm(source, delim::Char, eol::Char; options...)
69
+
70
+ If all data is numeric, the result will be a numeric array. If some elements cannot be
71
+ parsed as numbers, a heterogeneous array of numbers and strings is returned.
72
+ """
39
73
readdlm (input, dlm:: Char , eol:: Char ; opts... ) =
40
74
readdlm_auto (input, dlm, Float64, eol, true ; opts... )
75
+
76
+ """
77
+ readdlm(source, delim::Char, T::Type, eol::Char; header=false, skipstart=0, skipblanks=true, use_mmap, quotes=true, dims, comments=true, comment_char='#')
78
+
79
+ Read a matrix from the source where each line (separated by `eol`) gives one row, with
80
+ elements separated by the given delimiter. The source can be a text file, stream or byte
81
+ array. Memory mapped files can be used by passing the byte array representation of the
82
+ mapped segment as source.
83
+
84
+ If `T` is a numeric type, the result is an array of that type, with any non-numeric elements
85
+ as `NaN` for floating-point types, or zero. Other useful values of `T` include
86
+ `String`, `AbstractString`, and `Any`.
87
+
88
+ If `header` is `true`, the first row of data will be read as header and the tuple
89
+ `(data_cells, header_cells)` is returned instead of only `data_cells`.
90
+
91
+ Specifying `skipstart` will ignore the corresponding number of initial lines from the input.
92
+
93
+ If `skipblanks` is `true`, blank lines in the input will be ignored.
94
+
95
+ If `use_mmap` is `true`, the file specified by `source` is memory mapped for potential
96
+ speedups. Default is `true` except on Windows. On Windows, you may want to specify `true` if
97
+ the file is large, and is only read once and not written to.
98
+
99
+ If `quotes` is `true`, columns enclosed within double-quote (\" ) characters are allowed to
100
+ contain new lines and column delimiters. Double-quote characters within a quoted field must
101
+ be escaped with another double-quote. Specifying `dims` as a tuple of the expected rows and
102
+ columns (including header, if any) may speed up reading of large files. If `comments` is
103
+ `true`, lines beginning with `comment_char` and text following `comment_char` in any line
104
+ are ignored.
105
+ """
41
106
readdlm (input, dlm:: Char , T:: Type , eol:: Char ; opts... ) =
42
107
readdlm_auto (input, dlm, T, eol, false ; opts... )
43
108
@@ -624,7 +689,24 @@ function writedlm(fname::AbstractString, a, dlm; opts...)
624
689
end
625
690
end
626
691
692
+ """
693
+ writedlm(f, A, dl='\\ t'; opts)
694
+
695
+ Write `A` (a vector, matrix or an iterable collection of iterable rows) as text to `f`
696
+ (either a filename string or an `IO` stream) using the given delimiter `delim` (which
697
+ defaults to tab, but can be any printable Julia object, typically a `Char` or
698
+ `AbstractString`).
699
+
700
+ For example, two vectors `x` and `y` of the same length can be written as two columns of
701
+ tab-delimited text to `f` by either `writedlm(f, [x y])` or by `writedlm(f, zip(x, y))`.
702
+ """
627
703
writedlm (io, a; opts... ) = writedlm (io, a, ' \t ' ; opts... )
704
+
705
+ """
706
+ writecsv(filename, A; opts)
707
+
708
+ Equivalent to `writedlm` with `delim` set to comma.
709
+ """
628
710
writecsv (io, a; opts... ) = writedlm (io, a, ' ,' ; opts... )
629
711
630
712
show (io:: IO , :: MIME"text/csv" , a) = writedlm (io, a, ' ,' )
0 commit comments