Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter / naming functions? #24

Open
kescobo opened this issue Apr 17, 2018 · 3 comments
Open

Add filter / naming functions? #24

kescobo opened this issue Apr 17, 2018 · 3 comments

Comments

@kescobo
Copy link
Member

kescobo commented Apr 17, 2018

I was thinking it would be nice to have some filter!-type functions, as well as the ability to rename fields. So for example, I'd like to be able to do:

cm = ComMatrix([1 1 3; 1 2 1; 3 4 2],
                ["feat1","feat2","feat3"],
                ["foo_test", "bar_test", "baz_test"]
                )
sitenames!(cm, ["foo", "bar", "baz"])

to change the cm.sitenames to ["foo", "bar", "baz"]. Basically equivalent to the names! function from dataframes. And something similar for specnames! to change row names.

The other thing that would be useful would be to have the ability to do something like:

~~filter!(cm, startswith.(sitenames(cm), "b"))~~

I'm less certain how to implement this, since it would be useful to filter along both rows and columns, but I think there should be precedents in other table-creating packages. Though maybe this will be solved with the indexing stuff mentioned in #22

Only other thing is whether renaming functions should go here, or in EcoBase (I think maybe the later?)

@kescobo
Copy link
Member Author

kescobo commented Apr 17, 2018

I'm an idiot - I see now that the view function basically does what I'm asking for in filter. So ignore that part...

@mkborregaard
Copy link
Member

Yes, view should be able to do that exactly. I like the sitenames! function, will implement.

@kescobo
Copy link
Member Author

kescobo commented Apr 18, 2018

Should be fairly straightforward I think... though maybe best to implement in EcoBase as placenames! and thingnames!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants