uploading own data with repeats and do a grouped bar chart

library("ggplot2")

r

concentrations <- c(rep("control", 3), rep("0.5" , 3), rep("2.5" , 3), rep("5" , 3), rep("10" , 3), rep("25" , 3), rep("50" , 3) )
replicates <- rep(c("R1" , "R2" , "R3") , 7)
immobilised <- abs(r)
d1 <- data.frame(concentrations, condition, immobilised)

ggplot(d1,
aes(y=immobilised, x=concentrations, fill = replicates)) +
geom_bar(position="dodge", stat="identity")

this gives an error, help please!!

What is "r"? from your code

it gives lots of errors...
r not found , condition not found...
if I arbitrarily add :

 r <- 1:21
 condition <- replicates

before the d1 step I see a chart

r is the name of my data

With some modifications of "r" and "conditions" from @nirgrahamuk

library("ggplot2")
r <- 1:21
concentrations <- c( rep("control", 3),
                     rep("0.5" , 3), 
                     rep("2.5" , 3), 
                     rep("5" , 3), 
                     rep("10" , 3), 
                     rep("25" , 3), 
                     rep("50" , 3) )
replicates <- rep(c("R1" , "R2" , "R3") , 7)
condition <- replicates
immobilised <- abs(r)
d1 <- data.frame( concentrations, condition, immobilised )

ggplot( d1,
       aes(y=immobilised, x=concentrations, fill = replicates)) +
  geom_bar(position="dodge", stat="identity" )

thanks alot but what is r <- 1:21

That is what I asked you at first. Because you provided an undefined R object in your code.

Basically, there is no new data produced contrary to what you provided. We work on what you provided.

Refer to your original sample data and confirm, and confirm back

Remember that is what you ask us on what you were earlier asked.

this is r(my data)

So, what you have to do is to provide reproducible minimal sample data together with your codes and identify the problem you are facing. Do not forget to load/indicate the package you are using. Some sample data comes along with the packages.

Thus, if you produce a minimal reprex code with sample data, then forum users can easily help you!

A good example is in the code I provided you with the image.

sorry i suck at r, i have no idea what you mean

Hahaha!

Please follow here FAQ: How to do a minimal reproducible example ( reprex ) for beginners

And/or here https://reprex.tidyverse.org/

You can understand what forum users want to help you!

thanks so much for your help, but i might just use excel because its so much easier

What? Still, using excel?

If you need high-level graphics you have no choice but to migrate to .................

my report is due very soon and i don't have time to learn any more r, i just need some statistical analysis and write up the conclusion

Ok, I wish you all the best!

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.