0

This is probably a sloppy way to see it, but I wonder if the idea of longitudinal datasets (to be used in ggplot2, for instance), can be exlpained as complying with the criteria of data in a 1st normal form. I know the latter comes from the relational database field, but I would see entities within a db that is 1st normal as longitudinal dataframes. Does it make sense?

  • Unless you plan on storing this data in a database, it doesn't matter. – Robert Harvey Jul 17 '17 at 15:31
  • @RobertHarvey you mean because a set of longitudinal datasets wouldn't necessarily lead to a 1st normal form, but the reverse it true? – Dambo Jul 17 '17 at 15:36
  • 3
    I mean that "1st normal form," etc. are only meaningful in a relational database context. 1st normal form is generally the starting point in any such conversation, i.e. denormalized data. – Robert Harvey Jul 17 '17 at 15:36
1

Wide/fat/short and long/skinny/tall are both valid representations of multiply sampled data, each having their strengths and weaknesses. Both of these representations are valid longitudinal data sets in R as well as tables in relational databases.

Some argue that one form or the other violates database normalization concepts, but I don't see it. For example, some argue that the long/tall form repeats or duplicates keys (a violation of 1NF), but I would argue that the true row key in the long form is really a larger composite key (i.e. that includes another column), and thus not in violation of 1st normal form as composite keys don't violate normalization. In wide format, what is logically one constraint over sampled data has to be replicated across multiple columns, which is a duplication of sorts, though not a violation of 1st normal form.

In short, we can see both wide and long representation in databases without violating 1st normal form.

  • Just to make sure I'm understanding you, what you're saying is (using the example in OP's link) country_long has a key of (country, year) while country_wide has a key of country? – Andrew Jul 17 '17 at 18:01
  • @AndrewPiliser, yes, with the composite key, country_long is not violating 1NF. – Erik Eidt Jul 17 '17 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.