Quantcast
Channel: What can R do about a messy data format? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

What can R do about a messy data format?

$
0
0

Sometimes I see data posted in a Stack Overflow question formatted like in this question. This is not the first time, so I have decided to ask a question about it, and answer the question with a way to make the posted data palatable.

I will post the dataset example here just in case the question is deleted.

+------------+------+------+----------+--------------------------+|    Date    | Emp1 | Case | Priority | PriorityCountinLast7days |+------------+------+------+----------+--------------------------+| 2018-06-01 | A    | A1   |        0 |                        0 || 2018-06-03 | A    | A2   |        0 |                        1 || 2018-06-03 | A    | A3   |        0 |                        2 || 2018-06-03 | A    | A4   |        1 |                        1 || 2018-06-03 | A    | A5   |        2 |                        1 || 2018-06-04 | A    | A6   |        0 |                        3 || 2018-06-01 | B    | B1   |        0 |                        1 || 2018-06-02 | B    | B2   |        0 |                        2 || 2018-06-03 | B    | B3   |        0 |                        3 |+------------+------+------+----------+--------------------------+

As you can see this is not the right way to post data. As a user wrote in a comment,

It must've taken a bit of time to format the data the way you're showing it here. Unfortunately this is not a good format for us to copy & paste.

I believe this says it all. The asker is well intended and it took some work and time to try to be nice, but the result is not good.

What can R code do to make that table usable, if anything? Will it take a great deal of trouble?


Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>