Issue with raincloud plots

I have the following code for producing raincloud plots. This worked until a few days ago and now I get an error message (detailed below).

library(readr)
library(tidyr)
library(ggplot2)
library(Hmisc)
library(plyr)
library(RColorBrewer)
library(reshape2)
library(dplyr)
library(readxl)
library(Rmisc)

source("~/Downloads/RainCloudPlots-master/R_rainclouds.R")

w= 6
h= 3

my_data <- read_excel("~/Desktop/Work/UQCCR/ASIAN_ToM/Kessler_VPT/VPT2_raincloud_sham.xlsx")



my_data$group <- as.factor(my_data$group)
my_data$condition <- as.factor(my_data$condition)


sumrepdat <- summarySE(my_data, measurevar = "RT", groupvars=c("group", "condition"))



head(sumrepdat)



lb <- function(x) mean(x) - sd(x)
ub <- function(x) mean(x) + sd(x)




p11 <- ggplot(my_data, aes(x = group, y = RT, fill = condition)) +
  geom_flat_violin(aes(fill = condition),position = position_nudge(x = .1, y = 0), adjust = 1.5, trim = FALSE, alpha = .5, colour = NA)+
  geom_point(aes(x = as.numeric(group)-.15, y = RT, colour = condition),position = position_jitter(width = .05), size = .25, shape = 20)+
  geom_boxplot(aes(x = group, y = RT, fill = condition),outlier.shape = NA, alpha = .5, width = .1, colour = "black")+
  geom_line(data = sumrepdat, aes(x = as.numeric(group)+.1, y = RT_mean, group = condition, colour = condition), linetype = 3)+
  geom_point(data = sumrepdat, aes(x = as.numeric(group)+.1, y = RT_mean, group = condition, colour = condition), shape = 18) +
  geom_errorbar(data = sumrepdat, aes(x = as.numeric(group)+.1, y = RT_mean, group = condition, colour = condition, ymin = RT_mean-se, ymax = RT_mean+se), width = .05)+
  scale_colour_brewer(palette = "Dark2")+
  scale_fill_brewer(palette = "Dark2")+
  ggtitle("Figure R11: Repeated Measures - Factorial (Extended)")

#coord_flip()+

p11

This used to work fine but now I get the following error message :

Error in FUN(X[[i]], ...) : object 'RT_mean' not found

Any tips? I have tried installing updates but nothing seems to be working

Very likely something has changed in your input file that is preventing summarySE() from calculating the summary stats, that would be your starting point to debug your issue.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

data.frame(
          RT = c(702, 633.54, 621.75, 792.64, 717.14, 556.39, 642.75, 797.14,
                 669.57, 662.68, 687.54, 680.39, 359.57, 653.18, 601.21,
                 532.54, 552.64, 756.36, 811.93, 322.43, 472.64, 267.43, 202.82,
                 676.75, 583.79, 631.43, 572.86, 558.43, 712.71, 475.96, 1184.43,
                 334.18, 804.61, 680.39, 359.57, 484.25, 769.25, 819.54, 606.86,
                 557.25, 576.86, 699.32, 671.43, 594.46, 680, 775.64, 621.5, 870.25,
                 720.46, 555.07, 738.89, 849.57, 709.71, 740.14, 889.39, 752.21,
                 409.89, 680.89, 650.39, 552.54, 598.36, 690.39, 836.14, 371.89,
                 435.61, 268.25, 220.68, 618.79, 669.61, 671.07, 586.32, 577.46,
                 709.04, 488.79, 1341.36, 366.36, 1036.21, 752.21, 409.89, 564.46,
                 1100.93, 913.14, 651.96, 619.04, 593.64, 853.71, 789.89,
                 578.64, 769.75, 972.14, 676.25, 799.79, 867.39, 585, 717.36, 1064.39,
                 800.18, 754.5, 805.11, 1005.21, 598.68, 716.57, 763.5, 608.61,
                 737.21, 964.29, 797.14, 400.04, 609.71, 293.14, 227.25, 660.43,
                 904.36, 802.57, 715.64, 618.64, 830.54, 527.14, 1348.36, 523.5,
                 1695.5, 1005.21, 598.68, 533.82, 1247, 1174.57, 842.82, 629.43,
                 724.39, 1111, 798.14, 671.11, 710.75, 667.79, 601.82, 834.46,
                 651.61, 540, 724.75, 935.21, 769.43, 667.18, 749.82, 717.82,
                 346.89, 639.79, 655.5, 565.71, 600.18, 959.14, 767.11, 406.14, 416.82,
                 281.75, 201.21, 701.57, 570.89, 627.39, 614.11, 576.54, 664.36,
                 488.96, 1176.89, 339.43, 733.32, 717.82, 346.89, 504.79,
                 839.82, 930.89, 604.57, 582.71, 601.25, 715.43, 664.07, 614.89,
                 733.89, 886.57, 605.79, 766.61, 740.5, 544.71, 645.43, 952.93, 689.07,
                 725.64, 783.07, 773.75, 414.46, 689.36, 672.82, 550.18, 652.39,
                 1032.71, 907.21, 383.29, 404.21, 289.14, 235.5, 665.5, 790.32,
                 660.14, 649.07, 592.25, 693.04, 474.5, 1341.54, 371.04, 927.18,
                 773.75, 414.46, 606, 1237.5, 874.43, 636.39, 616.29, 658.25,
                 795.46, 715.5, 615.57, 884.43, 917.68, 777.14, 737.11, 1126.64,
                 566.54, 738.36, 1179, 799.07, 786.21, 992.64, 917.36, 553.57,
                 808.79, 691.39, 649.93, 870.29, 822.57, 917.07, 489.07, 624.18,
                 336.07, 206.25, 710.25, 1187.41, 889.36, 733.07, 661.89, 808.36,
                 589.86, 1533.11, 542.89, 1373.32, 917.36, 553.57, 544.96, 1239.96,
                 1056.86, 831.11, 657.5, 857.07, 1285.68, 765.54, 697.39),
       group = as.factor(c("1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "3", "3", "3", "3", "3", "3", "3", "3",
                           "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                           "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                           "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                           "3", "3", "3", "3", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "3", "3", "3", "3", "3",
                           "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                           "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                           "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                           "3", "3", "3", "3", "3", "3")),
   condition = as.factor(c("1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                           "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                           "2", "2", "2", "2", "2", "2"))
)

I've provided the data. Apologies if this is not suitable but I tried following the datapasta instructions. As I said before this exact dataframe worked previously so I am at a loss. Thanks for helping.

summarySE() produces a column named RT not RT_mean that is why you are getting the "not found" error, I can't tell if the rest of your code is OK since it is not reproducible.

library(Rmisc)

my_data <- data.frame(
  RT = c(702, 633.54, 621.75, 792.64, 717.14, 556.39, 642.75, 797.14,
         669.57, 662.68, 687.54, 680.39, 359.57, 653.18, 601.21,
         532.54, 552.64, 756.36, 811.93, 322.43, 472.64, 267.43, 202.82,
         676.75, 583.79, 631.43, 572.86, 558.43, 712.71, 475.96, 1184.43,
         334.18, 804.61, 680.39, 359.57, 484.25, 769.25, 819.54, 606.86,
         557.25, 576.86, 699.32, 671.43, 594.46, 680, 775.64, 621.5, 870.25,
         720.46, 555.07, 738.89, 849.57, 709.71, 740.14, 889.39, 752.21,
         409.89, 680.89, 650.39, 552.54, 598.36, 690.39, 836.14, 371.89,
         435.61, 268.25, 220.68, 618.79, 669.61, 671.07, 586.32, 577.46,
         709.04, 488.79, 1341.36, 366.36, 1036.21, 752.21, 409.89, 564.46,
         1100.93, 913.14, 651.96, 619.04, 593.64, 853.71, 789.89,
         578.64, 769.75, 972.14, 676.25, 799.79, 867.39, 585, 717.36, 1064.39,
         800.18, 754.5, 805.11, 1005.21, 598.68, 716.57, 763.5, 608.61,
         737.21, 964.29, 797.14, 400.04, 609.71, 293.14, 227.25, 660.43,
         904.36, 802.57, 715.64, 618.64, 830.54, 527.14, 1348.36, 523.5,
         1695.5, 1005.21, 598.68, 533.82, 1247, 1174.57, 842.82, 629.43,
         724.39, 1111, 798.14, 671.11, 710.75, 667.79, 601.82, 834.46,
         651.61, 540, 724.75, 935.21, 769.43, 667.18, 749.82, 717.82,
         346.89, 639.79, 655.5, 565.71, 600.18, 959.14, 767.11, 406.14, 416.82,
         281.75, 201.21, 701.57, 570.89, 627.39, 614.11, 576.54, 664.36,
         488.96, 1176.89, 339.43, 733.32, 717.82, 346.89, 504.79,
         839.82, 930.89, 604.57, 582.71, 601.25, 715.43, 664.07, 614.89,
         733.89, 886.57, 605.79, 766.61, 740.5, 544.71, 645.43, 952.93, 689.07,
         725.64, 783.07, 773.75, 414.46, 689.36, 672.82, 550.18, 652.39,
         1032.71, 907.21, 383.29, 404.21, 289.14, 235.5, 665.5, 790.32,
         660.14, 649.07, 592.25, 693.04, 474.5, 1341.54, 371.04, 927.18,
         773.75, 414.46, 606, 1237.5, 874.43, 636.39, 616.29, 658.25,
         795.46, 715.5, 615.57, 884.43, 917.68, 777.14, 737.11, 1126.64,
         566.54, 738.36, 1179, 799.07, 786.21, 992.64, 917.36, 553.57,
         808.79, 691.39, 649.93, 870.29, 822.57, 917.07, 489.07, 624.18,
         336.07, 206.25, 710.25, 1187.41, 889.36, 733.07, 661.89, 808.36,
         589.86, 1533.11, 542.89, 1373.32, 917.36, 553.57, 544.96, 1239.96,
         1056.86, 831.11, 657.5, 857.07, 1285.68, 765.54, 697.39),
  group = as.factor(c("1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                      "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                      "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                      "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                      "1", "1", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                      "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                      "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                      "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                      "2", "2", "2", "3", "3", "3", "3", "3", "3", "3", "3",
                      "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                      "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                      "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                      "3", "3", "3", "3", "1", "1", "1", "1", "1", "1", "1",
                      "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                      "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                      "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                      "1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2",
                      "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                      "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                      "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                      "2", "2", "2", "2", "2", "3", "3", "3", "3", "3",
                      "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                      "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                      "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3",
                      "3", "3", "3", "3", "3", "3")),
  condition = as.factor(c("1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
                          "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
                          "2", "2", "2", "2", "2", "2"))
)


my_data$group <- as.factor(my_data$group)
my_data$condition <- as.factor(my_data$condition)


sumrepdat <- summarySE(my_data, measurevar = "RT", groupvars=c("group", "condition"))

head(sumrepdat)
#>   group condition  N       RT       sd       se       ci
#> 1     1         1 44 614.7866 172.5872 26.01849 52.47130
#> 2     1         2 44 636.9880 186.3503 28.09336 56.65567
#> 3     2         1 44 670.6905 211.0444 31.81614 64.16337
#> 4     2         2 44 686.0775 219.4874 33.08897 66.73027
#> 5     3         1 44 784.0014 267.2972 40.29657 81.26578
#> 6     3         2 44 814.2700 265.1558 39.97374 80.61474

Created on 2020-01-05 by the reprex package (v0.3.0)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.