[R Beginners] Sankey chart using your dataframe in GGPLOT full customisation of labels and nodes.

Поделиться
HTML-код
  • Опубликовано: 9 фев 2025

Комментарии • 30

  • @emranhossain5624
    @emranhossain5624 3 года назад +1

    Darun video onk helpful.. Thank u so much

  • @rayhanhossain2643
    @rayhanhossain2643 3 года назад +1

    Intersting video

  • @tiktokbyshahzadi560
    @tiktokbyshahzadi560 3 года назад +2

    Thank you for this video

  • @ariffaraji1885
    @ariffaraji1885 3 года назад

    Great brother.. Carry on

  • @birasafabrice
    @birasafabrice 3 года назад +1

    thank you for this great video!

  • @zehencoc4563
    @zehencoc4563 3 года назад +1

    Fantastic

  • @siminyan9179
    @siminyan9179 Год назад +1

    Thanks for this great video, may I ask why my Sankey diagram are showing in a Quartz 2 window, not in the Plots window as your video? (I am using mac with R 4.3.2)

    • @DataAnalytic
      @DataAnalytic  Год назад

      Hi. Thanks for your comment. I am not a Mac user so can't add to your knowledge but on searching I found this link on stackoverflow.com/questions/38555768/unable-to-get-plots-displayed-in-rstudio-graphical-viewer
      All the best, if you figure out then please consider sharing it with other viewers.

  • @tazulislam8580
    @tazulislam8580 3 года назад

    Thanks for sharing this video

  • @hugohenriquez9992
    @hugohenriquez9992 7 месяцев назад +1

    Nice video! .
    I got a question, how can I use data with NA values ? .

    • @DataAnalytic
      @DataAnalytic  7 месяцев назад +1

      Try filling the NAs with a string like 'Not Available' or 'Blank', but be aware that the NAs might be at each node level, so do this write at the start.

  • @fromsrikant
    @fromsrikant Год назад +1

    thanks v helpfull

  • @Nikki-ku4ot
    @Nikki-ku4ot Год назад +1

    Great videos. When I was trying to run the ggsankey, I got an error code" Error in library(ggsankey): there is no package called ‘ggsankey’ while the package looked installed. Do you know why? Thanks!

    • @DataAnalytic
      @DataAnalytic  Год назад

      Thanks for the complement.
      Are you sure you have installed the ggsankey successfully. This package is not available in CRAN
      So that means you have to install it from the authors github.
      that means that you have to install the remotes package first and then install the ggsankey package as explained below.
      I am sure that this was the reason for your error.
      as hsow below.
      #install.packages("remotes")
      #remotes::install_github("davidsjoberg/ggsankey")
      Complete code listing is here
      rpubs.com/techanswers88/multiple-choice-questions-in-ggplot-sankey

  • @albea2
    @albea2 Год назад +1

    Thank you for the video. On doing the first step (make_long) I get an error code: 'across' is not an exported object from 'namespace:dplyr'. Do you know what may have caused this?

    • @DataAnalytic
      @DataAnalytic  Год назад

      Hello
      the make_long is actually from ggsankey package which uses dplyr across verb. In older versions of dplyr the across is not available.
      1. Try reinstalling or updating your dplyr package first.
      2. Then try to reinstall ggsankey if the error still persists.

  • @JN-jf9jg
    @JN-jf9jg 3 года назад +1

    Thank you very much for this great video!!
    Is there any way to manually control the color of the node connections as well? So that the color of the link is not automatically the same color as the node left to it?

    • @DataAnalytic
      @DataAnalytic  3 года назад +1

      Hi
      There is some control on that using the node.color and node.fill commands
      pl

  • @samrusaati9173
    @samrusaati9173 2 года назад +1

    Thank you for this video. I have a question: how to make multi-choice answers as one node?

    • @DataAnalytic
      @DataAnalytic  2 года назад +1

      Hi Sam
      Here is a mock up which I created, the scenario is that you have a multiple choice question and you want to show the number of responses for each question in a sankey diagram.
      eg.
      Question :How many pizzas you eat in a month
      Choices : '1 Pizza', '2 Pizzas', '3 Pizzas'
      And when the people provide their responses., you can show the responses in a sankey.
      Here is the code
      rpubs.com/techanswers88/multiple-choice-questions-in-ggplot-sankey
      Hope it helps.

  • @ahnafkabir3899
    @ahnafkabir3899 3 года назад

    Love it

  • @mahmoudalwakeel8766
    @mahmoudalwakeel8766 2 года назад

    Thank you so much. Amazing presentation but only one thing remained to be completed. How to make the flow color same from the source node till arrive to the final target ? so reader can see each category in first source what happen to them till they arrive the target

    • @DataAnalytic
      @DataAnalytic  2 года назад

      Thanks. Yes, good point, I might do a separate one just to cover the aesthetics.

  • @anikhasan8008
    @anikhasan8008 3 года назад

    ধন্যবাদ

  • @constanzamartinez1780
    @constanzamartinez1780 9 месяцев назад +1

    Hi..thanks for your video...I´m having problems with geom_sankey
    maybe you can help me
    Error in `geom_sankey()`:
    ! Problem while computing stat.
    ℹ Error occurred in the 1st layer.
    Caused by error in `map()`:
    ℹ In index: 1.
    Caused by error in `dplyr::mutate()`:
    ℹ In argument: `dplyr::across(c(x, next_x), ~as.numeric(.), .names =
    ("n_{.col}"))`.
    Caused by error in `across()`:
    ! Can't select columns that don't exist.
    ✖ Column `next_x` doesn't exist.
    I verify and I have the columns next_X
    I appreciate you help

    • @DataAnalytic
      @DataAnalytic  9 месяцев назад

      Looks like something is wrong with the data.
      There is a link in the description of the video which has the code with some sample data. If you have not seen it yet, then please try to run the code and see if you are able to get a plot.
      If you still have an issue, then paste some dummy data in the comment so that I can try it out.

  • @akashranjan02
    @akashranjan02 Месяц назад +1

    Package is corrupt, not working!!!

    • @DataAnalytic
      @DataAnalytic  Месяц назад +1

      Hi
      Just tested installing it on a fresh machine and it worked fine.
      I used the following two commands
      install.packages("remotes")
      remotes::install_github("davidsjoberg/ggsankey")
      And it resulted it installing the package. And I was able to use the code to produce the charts
      rpubs.com/techanswers88/multiple-choice-questions-in-ggplot-sankey
      See bnelow the messages received during installation of the packages.
      Note: It may also ask to update the dependencies ( additional packages which the ggsankey library might be using.
      I chose to skip the updates.
      remotes::install_github("davidsjoberg/ggsankey")
      Downloading GitHub repo davidsjoberg/ggsankey@HEAD
      These packages have more recent versions available.
      It is recommended to update all of them.
      Which would you like to update?
      1: All
      2: CRAN packages only
      3: None
      4: glue (1.7.0 -> 1.8.0 ) [CRAN]
      5: cli (3.6.2 -> 3.6.3 ) [CRAN]
      6: pillar (1.9.0 -> 1.10.0) [CRAN]
      7: withr (3.0.0 -> 3.0.2 ) [CRAN]
      8: colorspace (2.1-0 -> 2.1-1 ) [CRAN]
      9: cpp11 (0.4.7 -> 0.5.1 ) [CRAN]
      10: gtable (0.3.5 -> 0.3.6 ) [CRAN]
      Enter one or more numbers, or an empty line to skip updates:
      ── R CMD build ────────────────────────────────────────────────────────────────────────────────────────
      ✔ checking for file 'C:\Users\HS\AppData\Local\Temp\Rtmp8QheiR
      emotes300454ed4de2\davidsjoberg-ggsankey-b675d0d/DESCRIPTION' ...
      ─ preparing 'ggsankey':
      ✔ checking DESCRIPTION meta-information
      ─ checking for LF line-endings in source and make files and shell scripts
      ─ checking for empty or unneeded directories
      ─ building 'ggsankey_0.0.99999.tar.gz'
      Installing package into ‘C:/Users/HS/AppData/Local/R/win-library/4.4’
      (as ‘lib’ is unspecified)
      * installing *source* package 'ggsankey' ...
      ** using staged installation
      ** R
      ** byte-compile and prepare package for lazy loading
      ** help
      *** installing help indices
      *** copying figures
      ** building package indices
      ** testing if installed package can be loaded from temporary location
      ** testing if installed package can be loaded from final location
      ** testing if installed package keeps a record of temporary installation path
      * DONE (ggsankey)

  • @zehencoc4563
    @zehencoc4563 3 года назад

    আরও অনেক ভিডিও দিবেন আশা করি