R Project - how to create bar chart (ggplot2) from spreadsheet-includes data pivot & remove a column

Тәжірибелік нұсқаулар және стиль

In an R script upload a spreadsheet, manipulate the data by removing column/variable, change variable name, and pivot columns, and then producing a bar chart.
Timings:
00:00 Introduction
00:40 Set up R script and load data
02:10 Remove a column/variable from the database
03:20 Change column/variable header name
04:35 Set order of category (change from default alphabetical)
07:20 Pivot using pivot_longer (tidyr package)
10:10 Set up bar chart (ggplot2 package)
13:00 Add labels to bar chart
15:10 Themes (theme()) changes to bar chart
19:00 Change colour of bars/columns.
The video mentioned at 3.10 relating to altering the number of observations/variables (rows/columns) can be found at • In R dataframe - how t...
There is a lot more alterations which can be done to the bar chart using ggplot2. A reference which you may find helpful - ggplot2.tidyverse.org/referen.... This also explains why geom_col is used in this video, rather than geom_bar - ie it is because want height of bars to represent the values in the data.
The excel spreadsheet used in this project can be found at dataforknowledge.co.uk/r-proj...
Note: 3rd party data was used in this project therefore I take no responsibility for the quality or accuracy of the data. The data can be found at www.gov.scot/publications/tea...
#rprogramming #barchart #ggplot2 #rproject #data #ggplot2barchart

Пікірлер: 29

  • @leanne-se2sp
    @leanne-se2sp2 ай бұрын

    Hi, I'm in my 2nd year at university and have never been able to grasp R in any of the workshops but your video made it so easy! Thank you so much, I have been panicking about this assignment for weeks, and with your video, I can finally get it done, thank you again :) 10/10!

  • @DFK_data

    @DFK_data

    2 ай бұрын

    Thank you! Glad the video helped. Good luck with your studies!

  • @APerson-ky2gh
    @APerson-ky2gh2 ай бұрын

    Thanks so much, I'm a second year biology student who just started learning r for ecology data stuff and this video was so helpful

  • @DFK_data

    @DFK_data

    2 ай бұрын

    Thank you! Glad the video helped. Good luck with your studies!

  • @lucacotan4492
    @lucacotan449210 ай бұрын

    Thank you so much for the video! You actually showed perfectly how to transform the excel sheet into a barplot in "R"!

  • @DFK_data

    @DFK_data

    10 ай бұрын

    You're very welcome!

  • @terungwaemmanuel-i8h
    @terungwaemmanuel-i8h5 күн бұрын

    The video is interesting

  • @DFK_data

    @DFK_data

    5 күн бұрын

    Thank you! Thanks for watching the video

  • @inamhameed4963
    @inamhameed4963 Жыл бұрын

    Great, well-structured and organized. Much recommended your channel!!!

  • @DFK_data

    @DFK_data

    Жыл бұрын

    Thanks! Much appreciated

  • @DingDongGrahamBell
    @DingDongGrahamBell7 ай бұрын

    Thank YOU so much! Quite informative! Have a Blessed New Year!

  • @DFK_data

    @DFK_data

    7 ай бұрын

    Thank you! Glad you found the video helpful

  • @lindalangford320
    @lindalangford3205 ай бұрын

    Thanks for such an informative video. It is greatly appreciated.

  • @DFK_data

    @DFK_data

    5 ай бұрын

    Thank you!

  • @diana.anuphama7901
    @diana.anuphama7901 Жыл бұрын

    Thank you so much. Extremely helpful and well presented.

  • @DFK_data

    @DFK_data

    Жыл бұрын

    Thank you! Glad you enjoyed the video

  • @diana.anuphama7901

    @diana.anuphama7901

    Жыл бұрын

    @@DFK_data of course. Please keep up the good work

  • @cristianjesus255
    @cristianjesus2555 ай бұрын

    OMG, this video helped me so much!!

  • @DFK_data

    @DFK_data

    5 ай бұрын

    Thanks! Glad you found the video helpful.

  • @papito-qf2jj
    @papito-qf2jj11 ай бұрын

    thanks alot , it is so helpful

  • @DFK_data

    @DFK_data

    11 ай бұрын

    Thanks for watching the video! Glad it was helpful.

  • @ibrahimlawan9663
    @ibrahimlawan96639 ай бұрын

    Column names with spaces can sometimes cause issues because R treats spaces as a special character that indicates the end of a command. To solve this, 1. you can use backticks to specify column names with spaces (e.g., ggplot(data, aes(x = `Age group`, y = Value)), 2. you can rename the column (e.g., data$Age_group

  • @DFK_data

    @DFK_data

    9 ай бұрын

    Thanks!

  • @pedropuente3761
    @pedropuente37619 ай бұрын

    Love this!

  • @DFK_data

    @DFK_data

    9 ай бұрын

    Thanks! Glad you enjoyed the video.

  • @moluscosm
    @moluscosm Жыл бұрын

    I LOVE YOU

  • @DFK_data

    @DFK_data

    Жыл бұрын

    Thanks!

  • @ren.auguste2200
    @ren.auguste22005 ай бұрын

    Excellent video! If I may ask, do you have any for species accumulation curves? Or know where can point me in the right direction? Hoping you have one, as you explained so well!

  • @DFK_data

    @DFK_data

    5 ай бұрын

    Thank you! No I haven't done a video on species accumulation curves but perhaps a good idea for a future video.

Келесі