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)
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.
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.
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!
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
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?
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.
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?
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.
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
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
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.
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)
Darun video onk helpful.. Thank u so much
Intersting video
Thank you for this video
Great brother.. Carry on
thank you for this great video!
You're so welcome!
Fantastic
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)
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.
Thanks for sharing this video
Nice video! .
I got a question, how can I use data with NA values ? .
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.
thanks v helpfull
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!
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
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?
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.
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?
Hi
There is some control on that using the node.color and node.fill commands
pl
Thank you for this video. I have a question: how to make multi-choice answers as one node?
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.
Love it
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
Thanks. Yes, good point, I might do a separate one just to cover the aesthetics.
ধন্যবাদ
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
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.
Package is corrupt, not working!!!
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)
আরও অনেক ভিডিও দিবেন আশা করি