Skip to content

Commit 526b83e

Browse files
committed
Update to latest FileIO syntax
1 parent 2d7cd0f commit 526b83e

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# StatFiles.jl v0.4.0
2+
* Export load and save
3+
14
# StatFiles.jl v0.3.0
25
* Update to ReadStat.jl 0.3.0
36

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ Use Pkg.add("StatFiles") in Julia to install StatFiles and its dependencies.
2222
To read a Stata, SPSS, or SAS file into a ``DataFrame``, use the following julia code:
2323

2424
````julia
25-
using FileIO, StatFiles, DataFrames
25+
using StatFiles, DataFrames
2626

2727
df = DataFrame(load("data.dta"))
2828
````
2929

3030
The call to ``load`` returns a ``struct`` that is an [IterableTable.jl](https://github.com/davidanthoff/IterableTables.jl), so it can be passed to any function that can handle iterable tables, i.e. all the sinks in [IterableTable.jl](https://github.com/davidanthoff/IterableTables.jl). Here are some examples of materializing a Stata, SPSS, or SAS file into data structures that are not a ``DataFrame``:
3131

3232
````julia
33-
using FileIO, StatFiles, DataTables, IndexedTables, TimeSeries, Temporal, Gadfly
33+
using StatFiles, DataTables, IndexedTables, TimeSeries, Temporal, Gadfly
3434

3535
# Load into a DataTable
3636
dt = DataTable(load("data.dta"))
@@ -53,7 +53,7 @@ plot(load("data.dta"), x=:a, y=:b, Geom.line)
5353
``load`` also support the pipe syntax. For example, to load a Stata, SPSS, or SAS file into a ``DataFrame``, one can use the following code:
5454

5555
````julia
56-
using FileIO, StatFiles, DataFrame
56+
using StatFiles, DataFrame
5757

5858
df = load("data.dta") |> DataFrame
5959
````

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ TableTraits 0.0.3
33
ReadStat 0.3.0
44
IterableTables 0.5.0
55
DataValues 0.3.0
6-
FileIO 0.4.0
6+
FileIO 0.9.0
77
TableTraitsUtils 0.1.2
88
IteratorInterfaceExtensions 0.0.2

src/StatFiles.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
module StatFiles
22

33
using ReadStat, IteratorInterfaceExtensions, TableTraits, TableTraitsUtils
4-
using DataValues
5-
import FileIO
4+
using DataValues, FileIO
65
import IterableTables
76

7+
export load
8+
89
struct StatFile
910
filename::String
1011
end
1112

12-
function load(f::FileIO.File{FileIO.format"Stata"})
13+
function fileio_load(f::FileIO.File{FileIO.format"Stata"})
1314
return StatFile(f.filename)
1415
end
1516

16-
function load(f::FileIO.File{FileIO.format"SPSS"})
17+
function fileio_load(f::FileIO.File{FileIO.format"SPSS"})
1718
return StatFile(f.filename)
1819
end
1920

20-
function load(f::FileIO.File{FileIO.format"SAS"})
21+
function fileio_load(f::FileIO.File{FileIO.format"SAS"})
2122
return StatFile(f.filename)
2223
end
2324

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using FileIO
21
using StatFiles
32
using IteratorInterfaceExtensions
43
using TableTraits

0 commit comments

Comments
 (0)