Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Retrieve example data as a dataset
| ResourceFunction["ExampleDataset"][arg] returns the ExampleData collection specified by arg as a Dataset. | 
Get an example dataset:
| In[1]:= | ![ResourceFunction["ExampleDataset"][{"Statistics", "AnimalWeights"}]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/6853b048cd4cf09c.png)  | 
| Out[1]= |   | 
Get another dataset:
| In[2]:= | ![ResourceFunction["ExampleDataset"][{"MachineLearning", "WineQuality"}]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/0876e78d3c39c629.png)  | 
| Out[2]= |   | 
Find homes in Boston with an age greater than 98 years:
| In[3]:= | ![ResourceFunction["ExampleDataset"][{"Statistics", "BostonHomes"}][
 Select[#AGE > 98 &]]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/2f24cc9afa97e6c6.png)  | 
| Out[3]= |   | 
Cross tabulate odor and edibility for mushrooms (we can see that odor is a good indicator of edibility):
| In[4]:= | ![ResourceFunction["CrossTabulate"][
 ResourceFunction["ExampleDataset"][{"MachineLearning", "Mushroom"}][
  All, {#odor, Last[#]} &]]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/2053b4a879b4351c.png)  | 
| Out[4]= |   | 
If an unknown dataset name is specified, then the result is a Failure:
| In[5]:= | ![ResourceFunction["ExampleDataset"][{"Statistics", "BlahBlah"}]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/0a16284217d6290c.png)  | 
| Out[5]= |   | 
The expected data types for the "Statistics" datasets in ExampleData are "MultivariateSample", "TimeSeries" and "EventSeries". ExampleData has the following data types:
| In[6]:= | ![Union[ExampleData[#, "DataType"] & /@ ExampleData["Statistics"]]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/3c084e288453bb72.png)  | 
| Out[6]= |   | 
A Failure is returned for other data types:
| In[7]:= | ![ResourceFunction[
 "ExampleDataset"][{"Statistics", "ScientificDiscoveries"}]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/3ee2f9699c21c798.png)  | 
| Out[7]= |   | 
Here is a summary of the successes and failures of for different data types in the "Statistics" example data collection:
| In[8]:= | ![Quiet[ResourceFunction["RecordsSummary"]@
  Map[ExampleData[#, "DataType"] -> Head[ResourceFunction["ExampleDataset"][#]] &, ExampleData["Statistics"]]]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/436d0f1c4e88db62.png)  | 
| Out[8]= |   | 
Some "MachineLearnining" example data have data shapes and variable names that do not match. In those cases, ExampleDataset returns Failure:
| In[9]:= | ![ResourceFunction["ExampleDataset"][{"MachineLearning", "BostonHomes"}]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/7565d3971c9819cb.png)  | 
| Out[9]= |   | 
Compare the length of the variable names:
| In[10]:= | ![Length[Flatten@
  Apply[List, ExampleData[{"MachineLearning", "BostonHomes"}, "VariableDescriptions"]]]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/65d8e8de9932a447.png)  | 
| Out[10]= |   | 
With the dimensions of the data:
| In[11]:= | ![Dimensions[
 Map[Flatten, List @@@ ExampleData[{"MachineLearning", "BostonHomes"}, "Data"]]]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/2ced814246901281.png)  | 
| Out[11]= |   | 
Here is an association that shows the successes and failures over the "MachineLearning" datasets:
| In[12]:= | ![Association[# -> Head[ResourceFunction["ExampleDataset"][#]] & /@ ExampleData["MachineLearning"]]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/724fb20b997a3b07.png)  | 
| Out[12]= |   | 
Summaries for all "Statistics" datasets in ExampleData that have six columns:
| In[13]:= | ![Block[{resAll},
 resAll = Quiet[Association@
    Map[# -> ResourceFunction["ExampleDataset"][#] &, ExampleData["Statistics"]]];
 ResourceFunction["RecordsSummary"] /@ Select[resAll, Head[#] === Dataset && Dimensions[#][[2]] == 6 &]
 ]](https://www.wolframcloud.com/obj/resourcesystem/images/ec3/ec30eed0-9151-4ef3-b7e0-404125cf06a4/356eaec4fae05f82.png)  | 
| Out[13]= |   | 
This work is licensed under a Creative Commons Attribution 4.0 International License