title: Error in unique.default(x, nmax = nmax) : unique() applies only to vectors in ggplot
body: <p>The error in the title occurs when I try and run this code. I am a beginner and do not understand how to fix it. I have included all code for reference. All of the lines previous to the ggplot line seem to work but that last line causes the error. </p>
  
  <pre><code>ClassStroopData_300 &lt;- read_csv("ClassStroopData_300.csv")
  Data300 &lt;-ClassStroopData_300
  mean(Data300$responseTime)
  sd(Data300$responseTime)
  Data300["WorkspaceVar1"] &lt;- grepl("_",Data300$note)
  WorkspaceVar1 that contains the info whether or not the column "note" contained a "_"
  Data300["WorkspaceVar2"] &lt;- grepl("text",Data300$content)
  Data300["WorkspaceVar3"] &lt;-grepl("red_red|blue_blue|green_green|orange_orange|purple_purple",Data300$content)
  Data300["WorkspaceVar4"] &lt;- grepl("4db78970c3816d3d|a8cc6a79046e188f|c21c48d74bc99a6|dd2942c485109f3e|5eb0fbeb9b0685e2",Data300$frameId)
  Data300["incongruent"] &lt;- Data300$WorkspaceVar1*2
  Data300["instructions"] &lt;- Data300$WorkspaceVar2*1
  Data300["congruent"] &lt;- Data300$WorkspaceVar3*3
  Data300["practice"] &lt;- Data300$WorkspaceVar4*10
  Data300["condition sums"] &lt;- Data300$incongruent + Data300$instructions + Data300$congruent + Data300$practice
  Data300["condition"] &lt;- factor(Data300$`condition sums`,levels = c("1","2","3","12"),labels = c("instructions","incongruent","congruent","practice"))
  CongruentTrials &lt;- subset(Data300, condition == "congruent")
  mean(CongruentTrials$responseTime)
  sd(CongruentTrials$responseTime)
  IncongruentTrials &lt;- subset(Data300, condition == "incongruent")
  mean(IncongruentTrials$responseTime)
  sd(IncongruentTrials$responseTime)
  aggregate(Data300$responseTime,list(Data300$condition),mean)
  aggregate(Data300$responseTime,list(Data300$condition),sd)
  MICT &lt;- mean(IncongruentTrials$responseTime)
  SDICT &lt;- sd(IncongruentTrials$responseTime)
  MCT &lt;- mean(CongruentTrials$responseTime)
  SDCT &lt;- sd(CongruentTrials$responseTime)
  cbind(c(MICT,MCT), c(SDICT,SDCT))
  table = cbind(c(MICT,MCT), c(SDICT,SDCT))
  colnames(table) = c("mean","standard deviation")
  rownames(table) = c("Incongruent", "Congruent")
  t.test(IncongruentTrials$responseTime, CongruentTrials$responseTime, paired = T, var.equal = T)
  library(ggplot2)
  IncongruentNoOutliers &lt;- subset(IncongruentTrials, responseTime &lt; 1267.0660+401.6672*3.5 &amp; responseTime &gt; 1267.0660-401.6672*3.5)
  CongruentNoOutliers &lt;- subset(CongruentTrials, responseTime &lt; 1009.4660+352.9656*3.5 &amp; responseTime &gt; 1009.4660-352.9656*3.5)
  CongruentNoOutliers$Identify = "Congruent"
  IncongruentNoOutliers$Identify = "Incongruent"
  AllNoOutliers = rbind(CongruentNoOutliers, IncongruentNoOutliers)
  ggplot(AllNoOutliers, aes(x=responseTime, fill=as.factor(identify))) + geom_histogram(alpha = 0.5, position = 'identity') + scale_fill_discrete(name="Trial Type")
  </code></pre>