great video, thanks for sharing your knowledge :) is it possible to save the ggplots that you created with map() under individual names? (ca. minute 52:24)
Thanks Joschiiie! To save to individual files, you could create a custom function (instead of making the formula more complex), and then map it to the split dataframe. In this solution, notice how I construct the file name (not sure if there is a better way?). Also, I use walk() instead of map() because we are using the "side effect" (i.e. saving the plot) of the function: # custom plot + export function save_trend % walk(save_trend)
Thank you! If you want to use the different columns as arguments, and do row-wise operations, a function like purrr::pmap() would help: purrr.tidyverse.org/reference/map2.html
Hi, I am very new to R and I was struggling initially, after going through a couple of tutorials I feel confident. I have one issue when importing the CSV file, I get X in front of all the years. Could you please help me- how to remove 'X' from all the years?
Hi Patel! If you have an "X" that appears, it is because read.csv() will automatically "fix" names if they are unconventional, for example adding an "X" at the beginning if the header starts with a number, or replacing spaces with a full stop (because using them as is would throw an error). If you don't want that default behaviour, you can use the check.names argument and set it to "FALSE". For example: df
Hi Raibatak! The tilde "~" is used when you want to apply a more elaborate command instead of simply providing a function name and its arguments. You can then place the element that is processed by the map function (i.e. the ".x") anywhere in the formula, use it several times, nest functions... etc. In a nutshell, it gives you more flexibility than the default behaviour (which is "pick a function, use the currently processed element as the first argument, and optionally provide values for further arguments"). You will find more information with the documentation page, in the section about the argument ".f": ?map
Hi there! R 3.1.2 is from quite a few years ago, and I don't expect it to be supported by most recent R packages. You can see here that R 3.1 support by the Tidyverse was probably dropped earlier this year: www.tidyverse.org/articles/2019/04/r-version-support/ The first thing I'd recommend you to do is to update your R installation: cran.csiro.au/ (links for downloads are at the top of the page) Once you have the latest R installed (currently 3.6.1), try installing the Tidyverse again.
such a smooth flow of tutorials with crystal clear explanation. Appreciated
Great video. Thank you very much for this
Excellent Video! Thank you so much!
Awesome job, thank you very much!!
Merci Stéphane
Very helpful
Excelent explanation!
great work:)
Great
great video, thanks for sharing your knowledge :)
is it possible to save the ggplots that you created with map() under individual names? (ca. minute 52:24)
Thanks Joschiiie!
To save to individual files, you could create a custom function (instead of making the formula more complex), and then map it to the split dataframe. In this solution, notice how I construct the file name (not sure if there is a better way?). Also, I use walk() instead of map() because we are using the "side effect" (i.e. saving the plot) of the function:
# custom plot + export function
save_trend %
walk(save_trend)
@@uqlibrary great, many thanks for your response :) I will check that out!
Thank you so much for the great tutorial. Is it possible to use these functions on the rows as well?
Thank you!
If you want to use the different columns as arguments, and do row-wise operations, a function like purrr::pmap() would help: purrr.tidyverse.org/reference/map2.html
Did you also upload any videos on GitLab and importing R projects there please?
Or any other resource please provide the link. Thanks
Hi UQ Library, unable to convert data to long using the given function. I'm getting an error that says "could not find pivot longer". Please help
Hi, I am very new to R and I was struggling initially, after going through a couple of tutorials I feel confident. I have one issue when importing the CSV file, I get X in front of all the years. Could you please help me- how to remove 'X' from all the years?
Hi Patel!
If you have an "X" that appears, it is because read.csv() will automatically "fix" names if they are unconventional, for example adding an "X" at the beginning if the header starts with a number, or replacing spaces with a full stop (because using them as is would throw an error).
If you don't want that default behaviour, you can use the check.names argument and set it to "FALSE". For example:
df
@@uqlibrary Thank you very much. learned new troubleshooting by asking questions.
whats the use of ~ in map_int(~ length(....))
Hi Raibatak! The tilde "~" is used when you want to apply a more elaborate command instead of simply providing a function name and its arguments. You can then place the element that is processed by the map function (i.e. the ".x") anywhere in the formula, use it several times, nest functions... etc.
In a nutshell, it gives you more flexibility than the default behaviour (which is "pick a function, use the currently processed element as the first argument, and optionally provide values for further arguments").
You will find more information with the documentation page, in the section about the argument ".f": ?map
Can you help me with this issue?? "package ‘tidyverse’ is not available (for R version 3.1.2)"
Hi there! R 3.1.2 is from quite a few years ago, and I don't expect it to be supported by most recent R packages. You can see here that R 3.1 support by the Tidyverse was probably dropped earlier this year: www.tidyverse.org/articles/2019/04/r-version-support/
The first thing I'd recommend you to do is to update your R installation: cran.csiro.au/ (links for downloads are at the top of the page)
Once you have the latest R installed (currently 3.6.1), try installing the Tidyverse again.