egor icon indicating copy to clipboard operation
egor copied to clipboard

naming convention: ego vs. egos, alter vs. alters

Open martinamorris opened this issue 3 years ago • 2 comments

The naming conventions in egor seem to be inconsistent with respect to the trailing s. When creating an egor object from the raw data frames, the syntax uses the trailing s:

object <- egor(egos = egodf, alters = alterdf, ...)

but the resulting object has components named object$ego and object$alter -- now the s has disappeared.

Was there a reason you chose this convention? I ask b/c I keep forgetting which has the s and which doesn't when I'm coding.

martinamorris avatar Jul 23 '21 22:07 martinamorris

There really is no good reason for this inconsistency other than it being an artifact of previous code versions. I agree that a consistent situation would be better. I stumbled on this before too.

To make this change as smooth as possible we'd have to decide on our "policy" in regards to plural or singular for variable and argument names.

Some thoughts on that:

  • In R especially within data.frames it is kind of a convention to use the singular for column names. This makes sense as the data class aldready implies that there are (potentially) several values.
  • Some people do advocate for using plurals whenever your variable contains several values (see [https://stackoverflow.com/questions/7663880/should-we-avoid-plural-names-for-variables](this stackoverflow post).
  • tidygraph which serves as a orientation for egor in some regards uses "edges" and "nodes".

I am leaning towards making the names of the elements of the egor object plurals. We could then set it up in a way that within activate() singular and plural work. Indexing the ego with $ and the singular would still work, as R quietly autocompletes incomplete names if there is only one partially matching variable name. Maybe that way we could minimize breaking existing code.

tilltnet avatar Aug 05 '21 17:08 tilltnet

I agree that plurals seems the right choice, and that exploiting the partial matching to maximize backwards compatibility would be great if possible.

martinamorris avatar Aug 05 '21 18:08 martinamorris