tommy1
April 12, 2022, 2:49pm
1
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!!
pe2ju
April 12, 2022, 2:53pm
2
tommy1:
r
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
pe2ju
April 12, 2022, 3:23pm
5
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" )
tommy1
April 12, 2022, 3:35pm
6
thanks alot but what is r <- 1:21
pe2ju
April 12, 2022, 3:46pm
7
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
pe2ju
April 12, 2022, 3:47pm
8
tommy1:
r
Remember that is what you ask us on what you were earlier asked.
pe2ju
April 12, 2022, 4:05pm
10
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.
tommy1
April 12, 2022, 4:17pm
11
sorry i suck at r, i have no idea what you mean
pe2ju
April 12, 2022, 4:22pm
12
tommy1
April 12, 2022, 4:29pm
13
thanks so much for your help, but i might just use excel because its so much easier
pe2ju
April 12, 2022, 4:33pm
14
What? Still, using excel?
If you need high-level graphics you have no choice but to migrate to .................
tommy1
April 12, 2022, 4:42pm
15
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
pe2ju
April 12, 2022, 4:43pm
16
Ok, I wish you all the best!
system
Closed
May 3, 2022, 4:43pm
17
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.