File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -116,18 +116,21 @@ function replicate(f::Function, n::Integer; use_threads=false)
116
116
results
117
117
end
118
118
119
+ cacheddatasets = Dict {String,Any} ()
119
120
"""
120
121
dataset(nm)
121
122
122
123
Return the data frame of test data set named `nm`, which can be a `String` or `Symbol`
123
124
"""
124
125
function dataset (nm:: AbstractString )
125
- path = joinpath (TestData, nm * " .feather" )
126
- if ! isfile (path)
127
- throw (ArgumentError (
128
- " Dataset \" $nm \" is not available.\n Use MixedModels.datasets() for available names." ))
126
+ get! (cacheddatasets, nm) do
127
+ path = joinpath (TestData, nm * " .feather" )
128
+ if ! isfile (path)
129
+ throw (ArgumentError (
130
+ " Dataset \" $nm \" is not available.\n Use MixedModels.datasets() for available names." ))
131
+ end
132
+ Feather. read (path)
129
133
end
130
- Feather. read (path)
131
134
end
132
135
dataset (nm:: Symbol ) = dataset (string (nm))
133
136
You can’t perform that action at this time.
0 commit comments