Long Formats

  • Comments posted to this topic are about the item Long Formats

  • Need to dust off my R
    very true that if you don't use it for a while, you lose it...

    Thanks for the question, Steve

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    β€œlibera tute vulgaris ex”

  • For sure. I had to mess with this a bit to get an understanding, and then search a few older commands to set up a demo. This is after I haven't done any R in a month.

  • Not done much with R yet, definitely need to upskill!
    Thanks for the question Steve

    ---------------------------------------------------------------------------------------
    The more you know, the more you know that you dont know

  • My answer would be ... don't do this in R. πŸ˜€  It's simple to do in T-SQL.  And it's funny a bit... you've nicely covered up the word "EAV" with the term, "Long Format". πŸ˜‰

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Friday, August 17, 2018 7:36 AM

    My answer would be ... don't do this in R. πŸ˜€  It's simple to do in T-SQL.  And it's funny a bit... you've nicely covered up the word "EAV" with the term, "Long Format". πŸ˜‰

    Long format is the R term. You do this for analysis in plotting to get multiple values. This isn't for modeling or storage.

  • Steve Jones - SSC Editor - Friday, August 17, 2018 8:10 AM

    Jeff Moden - Friday, August 17, 2018 7:36 AM

    My answer would be ... don't do this in R. πŸ˜€  It's simple to do in T-SQL.  And it's funny a bit... you've nicely covered up the word "EAV" with the term, "Long Format". πŸ˜‰

    Long format is the R term. You do this for analysis in plotting to get multiple values. This isn't for modeling or storage.

    So R can't handle a 2 column row of data? πŸ˜€  (Just kidding).

    I may have to break down and learn more about R because I do like the syntactical brevity a whole lot.  I wish MS understood that when the wrote PIVOT.  For that matter, they'd have done well if the incorporated the features of PIVOT found in MS Access instead of the god-awful one they settled on for SQL Server.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Friday, August 17, 2018 8:38 AM

    So R can't handle a 2 column row of data? πŸ˜€  (Just kidding).

    I may have to break down and learn more about R because I do like the syntactical brevity a whole lot.  I wish MS understood that when the wrote PIVOT.  For that matter, they'd have done well if the incorporated the features of PIVOT found in MS Access instead of the god-awful one they settled on for SQL Server.

    It can, but for plotting multiple items, think multiple line charts together, you want the long format.

    Don't learn R. It's  got no great advantage I can see of Python and Python can do all of what R does and more. Most of the data analysis stuff has been ported to Python.

  • Steve Jones - SSC Editor - Friday, August 17, 2018 10:20 AM

    Jeff Moden - Friday, August 17, 2018 8:38 AM

    So R can't handle a 2 column row of data? πŸ˜€  (Just kidding).

    I may have to break down and learn more about R because I do like the syntactical brevity a whole lot.  I wish MS understood that when the wrote PIVOT.  For that matter, they'd have done well if the incorporated the features of PIVOT found in MS Access instead of the god-awful one they settled on for SQL Server.

    It can, but for plotting multiple items, think multiple line charts together, you want the long format.

    Don't learn R. It's  got no great advantage I can see of Python and Python can do all of what R does and more. Most of the data analysis stuff has been ported to Python.

    Good tip.  Thanks, Steve.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • You're welcome. Once I started with R, I realized it's a PIA and nowhere near as clear. I had some Python experience and started to see all the plotting, all the ML, all the analysis libraries in R that existed in Python. If you want to have some fun and get started, this is a good book you can read online: http://www.diveintopython3.net/

    You can download Python 3 and put it on a laptop. I started with the free PyCharm IDE, but now I tend to use some VSCode. Both work well.

  • Steve Jones - SSC Editor - Saturday, August 18, 2018 11:33 AM

    You're welcome. Once I started with R, I realized it's a PIA and nowhere near as clear. I had some Python experience and started to see all the plotting, all the ML, all the analysis libraries in R that existed in Python. If you want to have some fun and get started, this is a good book you can read online: http://www.diveintopython3.net/

    You can download Python 3 and put it on a laptop. I started with the free PyCharm IDE, but now I tend to use some VSCode. Both work well.

    Awesome.  Thanks again, Steve.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply