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

Input and output formats #2

Open
2 of 5 tasks
joeroe opened this issue Dec 29, 2018 · 12 comments
Open
2 of 5 tasks

Input and output formats #2

joeroe opened this issue Dec 29, 2018 · 12 comments
Labels
enhancement New feature or request
Milestone

Comments

@joeroe
Copy link
Owner

joeroe commented Dec 29, 2018

We should be able to read and write data to/from these formats:

We probably won't be handle these formats:

@nevrome
Copy link

nevrome commented Jan 2, 2019

How would you like to implement these data types? A read.* function for each type? Or S3 classes that reproduce the respective table structure? Only input or also output?

@joeroe
Copy link
Owner Author

joeroe commented Jan 2, 2019

Good question! I don't think having S3 classes for each would be worthwhile, since they all represent the same thing. What we need are read_ functions that transform each to a standardised, tabular data structure that describes the stratigraphic relationship between units. That can then be turned into a matrix (an S3 stratigraph object) using rules specified by a function like harris().

The question is what the intermediate tabular format should look like. My preference would be something that follows tidy principles, i.e. a single table, where 1 row corresponds to 1 stratigraphic unit and all other observations are columns. Multiple relations can be expressed as nested vectors like those used in vignette(harris).

And yes, now you mention it we should provide write_ functions for all these too.

@joeroe joeroe changed the title Input formats Input and output formats Jan 2, 2019
@tsdye
Copy link

tsdye commented Jan 3, 2019

Harris' law of stratigraphical succession is satisfied by transitive reduction of the DAG. The intermediate tabular format might want to serve up information to the transitive reduction function with as little fuss as possible. Transitive reduction is another feature igraph apparently lacks: igraph/igraph/issues/932

@nevrome
Copy link

nevrome commented Jan 3, 2019

Ja - the main datatype (and maybe a list class for many of these objects?) has to be defined with all necessary class methods (is., as., format., print.). We probably also have to define the accessors [, [<-, ... to make sure that adding and removing stratigraphic units is handled correctly.

I like your harris12 sample datatset, @joeroe. List columns are fashionable and a cool feature of R data.frames. If we inherit from tibbles, we already have an excellent base class.

@tsdye Are you aware of a way to access lisp code from R? I guess it would be great to access the functionality of hm for stratigraphr. Could you compile the package to a command line tool? Something that simply runs on any shell after compilation? I just googled for a while without clear results. Lisp is an interpreter language and one always need an interpreter to run it, ja? Just like R?

@tsdye
Copy link

tsdye commented Jan 3, 2019

@nevrome, yes, lisp can produce stand-alone binaries with a command line interface. It is a bit tricky to write code that works cross-platform, so I'm not sure about producing command line tools for every OS with the hm code. Nevertheless, that is one of my goals for the hm project.
I doubt it is possible to call lisp code from R, but I don't know.

@nevrome
Copy link

nevrome commented Jan 3, 2019

@tsdye A command line interface would be great! It's simple enough to call a command line tool from within R. Maybe we could even provide hm with the R package as we did with oxcal in oxcAAR.

stratigraphr could be a simple interface between tidy data and network visualisation in R on the one hand, and Harris graph algorithm implementation in lisp via hm on the other. No need to reinvent the wheel. What do you think @joeroe? Is this a way to go?

Repository owner deleted a comment from nevrome Jan 3, 2019
@joeroe
Copy link
Owner Author

joeroe commented Jan 3, 2019

(The comment I just deleted was a duplicate.)

@joeroe
Copy link
Owner Author

joeroe commented Jan 3, 2019

I'm actually in favour of reinventing wheels, as long as they're not too complicated. It's often easier than having to deal with external dependencies in the long run. But it might be a good stopgap.

@tsdye
Copy link

tsdye commented Jan 4, 2019

Either way is fine with me. I plan to work on hm again this summer, which might or might not suit your plans.

@nevrome
Copy link

nevrome commented Jan 4, 2019

Alright. I could offer to write some reader and writer functions for stratigraphr when the main class is defined.

@joeroe
Copy link
Owner Author

joeroe commented Sep 8, 2020

b1daaf3 added a read_lst() function, but I only had one file to test it with so it might not be the most robust.

@joeroe
Copy link
Owner Author

joeroe commented Oct 5, 2020

As expected it is not very robust: #9

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

No branches or pull requests

3 participants