top of page

Gemstracker and HandWristStudyGroup data

R-course: RYouReady

General introduction to R and GitHub

R-course: RYouReady

Applying R to HandWristStudyGroup data

VizWhiz 3: Using bar and column graphs

In VizWhiz 3 you learn, among other things, to make bar plots. In this video below, you can see how to show the standard deviation or standard error can be plotted in combination with the mean.

Assignment

 

Make a plot, analogous to how it is shown in the video, with the average VAS pain for men and women, and with error bars for the standard error. Therefore you must first calculate the standard error. You can calculate the standard error by using the sd, n, and square root (sqrt) and then assigning R to do this.

 

 

 

 

 

 

 

 

 

Scatterplots

 

Scatter plots are very important in any study with subjects or patients. They are very suitable for showing how one variable (age, for example) is related to another variable (admission to the ICU, for example). They provide insight into relationships, where all test subjects can be seen in 1 plot. In addition, you can clearly see potential outliers or, for example, non-linear relations. 

Watch the recording below, especially the period of about 2 to 5 minutes after start.

#Make a plot, analogous to the movie, with the average VAS pain for men and women, with error bars for the standard error.

data_combined %>% 
    na.omit() %>% 
    group_by(geslacht) %>% 
    summarise (mean = mean(vasPijnGemiddeld_1),
               sd = sd(vasPijnGemiddeld_1),
               n = n(),
               stderr = sd/sqrt(n)) %>% 
    ggplot(aes(x=geslacht, y = mean)) +
    geom_col() +
    geom_errorbar(aes(x=geslacht, ymin = mean - stderr, ymax = mean+stderr))

Answers

Assignment

    • Make a scatter plot in which you can show to what extent VAS pain correlates with VAS function. Use geom_point with the VAS pain on the x-axis and VAS function on the y-axis. Fit a line with geom_smooth. 

    • Add color to distinguish between men and women 

#Make a scatter plot in which you can show to what extent VAS pain while resting matches with VAS pain during activities. Use geom_point with the omrom VAS pain while resting on the x-axis and VAS pain during activities on the y-axis. Fit a line with geom_smooth. 

data_combined %>% 
    na.omit() %>% 
    ggplot(aes(x=vasPijnGemiddeld_1, y = vasFunctie_1)) +
    geom_point() + 
    geom_smooth() 

#Add color to distinguish between men and women 
data_combined %>% 
    na.omit() %>% 
    ggplot(aes(x=vasPijnGemiddeld_1, y = vasFunctie_1, color = geslacht)) +
    geom_point() + 
    geom_smooth() 

Answers

You can now create many different types of plots. But they are not yet ready for placement in a scientific journal. For that, you still need to have control over the layout. You learn this in VizWhiz 4

VizWhiz4

bottom of page