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 by avinash
• 1,840 points

closed Jun 22, 2022 by avinash 550 views

Related Questions In Data Analytics

0 votes
1 answer
0 votes
2 answers

R function for finding the index of an element in a vector?

The function match works on vectors : x <- sample(1:10) x # ...READ MORE

answered Dec 12, 2020 in Data Analytics by Rajiv
• 8,870 points
56,632 views
+1 vote
2 answers

Which function can I use to clear the console in R and RStudio ?

Description                   Windows & Linux           Mac Clear console                      Ctrl+L ...READ MORE

answered Apr 17, 2018 in Data Analytics by anonymous
82,290 views
0 votes
1 answer

Why should I use set.seed function() in R?

set.seed(seed) Set the seed of R‘s random number ...READ MORE

answered Apr 24, 2018 in Data Analytics by zombie
• 3,790 points
1,816 views
0 votes
1 answer

How to write a custom function which will replace all the missing values in a vector with the mean of values in R?

Consider this vector: a<-c(1,2,3,NA,4,5,NA,NA) Write the function to impute ...READ MORE

answered Jul 4, 2018 in Data Analytics by CodingByHeart77
• 3,750 points
4,556 views
+1 vote
1 answer

How can I use which() function in R ?

which() function determines the position of elements ...READ MORE

answered Sep 25, 2018 in Data Analytics by Daisy
• 8,140 points
7,464 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,570 points
1,030 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
1,180 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
5,890 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,112 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP