R programming Graphs

+1 vote

This is my R code, I'm using the output to make some line graphs

    f    x  N       y           sd         se         ci         
1  Carla 1  5 0.577437500 0.538098341 0.240644894 0.668137337
2  Carla 2 21 1.975978653 3.258871642 0.711144094 1.483420586
3  Carla 3  8 1.217090357 1.936489842 0.684652549 1.618946022
4  Carla 4  6 0.004543219 0.002500954 0.001021010 0.002624590
5   Liam 1  4 0.356406250 0.203422619 0.101711309 0.323690780
6   Liam 2  8 5.164708412 5.169434477 1.827671087 4.321755376
7   Liam 3  4 0.019294020 0.002592634 0.001296317 0.004125459
8    Meg 1  3 0.337395833 0.383621255 0.221483835 0.952968025
9    Meg 2 11 2.218085777 3.889646592 1.172772574 2.613100136
10   Meg 3  3 2.239833477 3.810413346 2.199943171 9.465591491
11   Meg 4  3 0.004317894 0.002512864 0.001450803 0.006242301

And I tried making line graphs thru the following code:

# Standard error of the mean
ggplot(dfc, aes(x=x, y=y, colour=f)) + 
    geom_errorbar(aes(ymin=y-se, ymax=y+se), width=.1) +
    geom_line() +
    geom_point()

# The errorbars overlapped, so use position_dodge to move them horizontally
pd <- position_dodge(.1) # move them .05 to the left and right

ggplot(dfc, aes(x=x, y=y, colour=f)) + 
    geom_errorbar(aes(ymin=y-se, ymax=y+se), width=.1, position=pd) +
    geom_line(position=pd) +
    geom_point(position=pd)

I want to know if its possible to highlight the area occupied by the standard error

Feb 21, 2019 in Data Analytics by Sophie may
• 10,620 points
611 views

1 answer to this question.

0 votes

Try this:

ggplot(dfc, aes(x=x, y=y, colour=f, fill=f, ymin=y-se, ymax=y+se)) + 
  geom_ribbon(aes(colour=NULL),alpha=0.5) +
  geom_errorbar(width=.1) +
  geom_line() +
  geom_point() 


Hope this helps!

To know more, join R programming course today.

Thanks.

answered Feb 21, 2019 by Tyrion anex
• 8,700 points

Related Questions In Data Analytics

0 votes
1 answer

Plotting multiple graphs on the same page in R

If you want to plot 4 graphs ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,435 views
0 votes
2 answers

What are the rules to define a variable name in R programming language?

The same rules almost follow for all ...READ MORE

answered Aug 26, 2019 in Data Analytics by anonymous
• 33,030 points
15,154 views
0 votes
1 answer

Why should I adopt R programming

R Programming is the best mechanism for ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,840 points
841 views
+3 votes
2 answers

Error: could not find function - R Programming

Yes, Just like @Maverik said, It happens ...READ MORE

answered Aug 23, 2019 in Data Analytics by anonymous
• 33,030 points
33,745 views
0 votes
1 answer

R programming: Unexpected symbol error

Format your code this way: myfunction <- function() ...READ MORE

answered Dec 17, 2018 in Data Analytics by Sophie may
• 10,620 points
3,272 views
0 votes
1 answer

R Programming error in 'fert'

You're using a factor: fert <- factor(c(50,20,10,10,20,50)) levels(fert) #[1] ...READ MORE

answered Dec 28, 2018 in Data Analytics by Sophie may
• 10,620 points
732 views
+1 vote
1 answer

R Programming: Market Basket Analysis Error

The basket.sorted() has less than 5 rules. Refer ...READ MORE

answered Feb 12, 2019 in Data Analytics by Sophie may
• 10,620 points
1,543 views
+1 vote
1 answer

R Programming: regexpr error

The below code will help: gregexpr("D", x) # [[1]] # ...READ MORE

answered Feb 21, 2019 in Data Analytics by Tyrion anex
• 8,700 points
650 views
+1 vote
1 answer

R programming: How to subset data and plot graphs in R?

You can create a grouping variable depending ...READ MORE

answered Feb 18, 2019 in Data Analytics by Tyrion anex
• 8,700 points
992 views
+1 vote
1 answer

R programming error

Alright, you can either use gsub to match the ...READ MORE

answered Dec 18, 2018 in Data Analytics by Tyrion anex
• 8,700 points
679 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