+ Reply to Thread
Results 1 to 5 of 5

Thread: R ggplot NO alphabatize

  1. #1
    Points: 1,145, Level: 18
    Level completed: 45%, Points required for next Level: 55

    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    R ggplot NO alphabatize




    I am plotting box plots for several variables using ggplot. However, ggplot is alphabetizing the variables and I want them to present as the order I have them in the code. How could that be fixed?

  2. #2
    Devorador de queso
    Points: 97,518, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent PosterActivity Award
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,987
    Thanks
    308
    Thanked 2,639 Times in 2,254 Posts

    Re: R ggplot NO alphabatize

    Use a factor and make sure the levels are the way you want them
    I don't have emotions and sometimes that makes me very sad.

  3. The Following User Says Thank You to Dason For This Useful Post:

    bugman (08-28-2017)

  4. #3
    Devorador de queso
    Points: 97,518, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent PosterActivity Award
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,987
    Thanks
    308
    Thanked 2,639 Times in 2,254 Posts

    Re: R ggplot NO alphabatize

    I don't have emotions and sometimes that makes me very sad.

  5. #4
    ggplot2orBust
    Points: 72,900, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    User with most referrers
    trinker's Avatar
    Location
    Buffalo, NY
    Posts
    4,424
    Thanks
    1,815
    Thanked 931 Times in 812 Posts

    Re: R ggplot NO alphabatize

    "If you torture the data long enough it will eventually confess."
    -Ronald Harry Coase -

  6. The Following User Says Thank You to trinker For This Useful Post:

    bugman (08-28-2017)

  7. #5
    Super Moderator
    Points: 32,372, Level: 100
    Level completed: 0%, Points required for next Level: 0
    bugman's Avatar
    Posts
    2,255
    Thanks
    290
    Thanked 324 Times in 265 Posts

    Re: R ggplot NO alphabatize


    Or, if you are using Rstudio, you can use the "levels ordering" add in which is available through the "questionr" package
    The earth is round: P<0.05

+ Reply to Thread

           




Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats