I am trying to plot data in ggplot (I tried a CRAN version from github too), but I end up getting an error:
Error in is.finite(x) : default method not implemented for type 'list'
This is the code for the plot:
ggplot(SinglePatient, aes(x = Condition, y = new, fill = Session)) +
stat_summary(fun.y = mean, geom = "bar", color = 'black', size = 1, position = "dodge") +
stat_summary(fun.data = mean_se, geom ="errorbar", width = .1, size = 1, position = position_dodge(width=.9))+
xlab("Condition") + ylab("Reaction time (ms)") +
scale_y_continuous(expand = c(0,0)) +
plot_theme
This is an example of data from the data.frame that I am using:
Patient Session Stimulus Trial Running[Trial] Block ACC Side Condition Group new.RT
7212 post blue_color.jpg 14 Center2ExpTrialList 2 incorrect L Center2Exp BrainHQ 251
7212 post brown_color.jpg 6 Center2ExpTrialList 2 correct R Center2Exp BrainHQ 253
7212 post blue_color.jpg 19 Center2ExpTrialList 2 correct L Center2Exp BrainHQ 256
7212 post brown_color.jpg 23 Center2ExpTrialList 12 correct R Center2Exp BrainHQ 261
7212 post blue_color.jpg 18 Center2ExpTrialList 2 correct L Center2Exp BrainHQ 267
Any idea of what I need to change? Thank you so much for your time.
The solution for when I encountered this issue is to run unlist
on the columns you are giving to ggplot. The issue seems to be that ggplot doesn't want to plot things that are lists, and the problem was not solved by downloading the latest version of ggplot either. You may have inadvertently made the data you are giving it a list.
I solved this by simply doing the following:
dataframe$column <- unlist(dataframe$column)
Issue: data is somehow in a list format.
Solution: unlist()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With