# \[ANN\] MetaArrays: Add metadata to your arrays

**URL:** https://discourse.julialang.org/t/ann-metaarrays-add-metadata-to-your-arrays/23385
**Category:** Package Announcements
**Created:** [April 22, 2019, 12:47am UTC](https://discourse.julialang.org/t/ann-metaarrays-add-metadata-to-your-arrays/23385 "2019-04-22T00:47:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![haberdashPI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haberdashpi/32/26337_2.png) [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)
#### Post date: [April 22, 2019, 12:47am UTC](https://discourse.julialang.org/t/ann-metaarrays-add-metadata-to-your-arrays/23385/1 "2019-04-22T00:47:08Z")

</div>

Hello all,

I have just made a small package available in the General registry: [MetaArrays](https://github.com/haberdashPI/MetaArrays.jl). It provides a generic means of adding additional meta-data to an array, (typically) using a `NamedTuple`. (It is perhaps similar in spirit to ImagesMetadata.jl, but takes a slightly different approach). I have found it handy in my own projects, and thought others might as well.

It’s probably easiest to demonstrate with an example (also found in `README.md`)

```julia
julia> y = meta(rand(10,10),val1="value1")
julia> x = meta(rand(10,10),val2="value2")

julia> z = x.*y
julia> z.val1
"value1"

```

The main advantage I find in working with this particular approach is that I can:

1.) Specialize methods over the type of the array, or the type of the particular metadata.

2.) Readily leverage the broadcasting and array tooling for a new array type, without having to think through all of the methods I have to overwrite. I’ve already done that work once, within MetaArrays, and don’t have to re-think through it each time.

Check out the [README.md](https://github.com/haberdashPI/MetaArrays.jl) for more details.

I would appreciate any feedback (positive or negative) about the package.

---

<div class="post-metadata">

### Author: ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)
#### Post date: [May 24, 2019, 6:52pm UTC](https://discourse.julialang.org/t/ann-metaarrays-add-metadata-to-your-arrays/23385/2 "2019-05-24T18:52:16Z")

</div>

Neat! I’ve been thinking about something like this for tables (e.g. `TypedTables.Table`), to allow for plotting recipes for different kinds of tables without type piracy.

---

<div class="post-metadata">

### Author: ![haberdashPI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haberdashpi/32/26337_2.png) [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)
#### Post date: [May 24, 2019, 7:40pm UTC](https://discourse.julialang.org/t/ann-metaarrays-add-metadata-to-your-arrays/23385/3 "2019-05-24T19:40:31Z")

</div>

Interesting! I’m not sure I understand. Is the idea that you would be able to attach some set of attributes to a table that plotting could use? How would you deal with the fact that `data.column_name` is a very natural way to access columns of table. Seems like you would need a different spelling to get at the attributes.

---

<div class="post-metadata">

### Author: ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)
#### Post date: [May 24, 2019, 10:01pm UTC](https://discourse.julialang.org/t/ann-metaarrays-add-metadata-to-your-arrays/23385/4 "2019-05-24T22:01:08Z")

</div>

> you would be able to attach some set of attributes to a table that plotting could use

No, I was thinking more like metadata that indicates the “type” of the table and that a plotting recipe can specialize on.

---

<div class="post-metadata">

### Author: ![haberdashPI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haberdashpi/32/26337_2.png) [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)
#### Post date: [July 8, 2019, 8:38pm UTC](https://discourse.julialang.org/t/ann-metaarrays-add-metadata-to-your-arrays/23385/5 "2019-07-08T20:38:09Z")

</div>

A new version of [MetaArrays](https://github.com/haberdashPI/MetaArrays.jl) (v0.2.6) is now available. It fixes a few bugs and improves the README a bit.
