Hello, I am new to coding in r. I have a dataset, from which I need to compare three columns to one column,
This is what my data looks like:
A B C D E
Yes No No 6 No
Yes No No 2 Yes
No No No 13 Yes
Yes No No 1 Yes
No No No 5 Yes
I need to compare A, B, C on the x-axis with D on the y-axis and E on the z- axis.
This is my code:
trial <- read.csv("figs.csv",
header= TRUE,
sep= ",")
new_data <- factor(trial$A)
as.numeric(new_data)
pl<-ggplot()+
stat_boxplot(data = trial, geom = "errorbar",
mapping = aes(x= new_data ,y= D))+
geom_boxplot(data= trial, aes(x = new_data , y = D, fill = A))+
geom_jitter()
nd2 <- factor(trial$B)
as.numeric(nd2)
t1 <- pl +
stat_boxplot(data= trial, geom = "errorbar",
mapping = aes(x = nd2 , y = D))+
geom_boxplot(data= trial, aes(x = nd2 , y = D, fill = B))+
geom_jitter(position = position_jitter(0.2))
nd3 <- factor(trial$Social)
as.numeric(nd3)
t2 <- t1 +
stat_boxplot(data= trial, geom = "errorbar",
mapping = aes(x = nd3 , y = D))+
geom_boxplot(data= trial, aes(x = nd3 , y = D, fill = C))+
geom_jitter(position = position_jitter(0.2))
The problem I am facing is that, the three columns A, B, C are getting plotted one on top of the other and not as separate boxes.