Use of ggplot within another function in R [closed]

0 votes
Using the ggplot2 package, I'm attempting to create a straightforward plot function. However, the function argument is not found when ggplot is called.

Think about a number.

I want to plot two mean values from a frame called means that stores two conditions (condition will appear on the X axis, means on the Y).

library(ggplot2)
m <- c (13.8, 14.8)
data.frame(means=m, condition=cond) means what cond - c(1, 2) means.
# The result ought to be:
# indicates condition #1. 13.8 1 # 2 14.8 2

ggplot(meansdf, aes(fill=meansdf$condition, y=meansdf$means, x = meansdf$condition)) testplot - function(meansdf)
geom bar + p
position="dodge", identification stat=""

testplot(means)
# The following error will be shown as a result:
# Eval(expr, envir, enclos) error: not found object'meansdf'
Therefore, it appears like ggplot is calling eval, which is unable to locate the argument meansdf. Does anyone have any advice on how to do the task successfully?
closed with the note: /
Jun 22, 2022 in Data Analytics