I am using this code to plot my dataframe. The statistics variable contains two values: "mean" and "sd".
ggplot(NDVIdf_forplot, aes(x = statistic, y= value, group = ID)) + geom_line()
If I use that code the graph includes both the "mean" and "sd" categories. I want to use only those observations that are in the "mean" class of the statistic variable and later use the "sd" class to plot geom_errorbar
I used this code before but did not manage to create what I want:
ggplot(NDVIdf_forplot,aes(x=mean,y=value))+geom_errorbar(aes(ymin=NDVI_mean-NDVI_sd, ymax=NDVI_mean+NDVI_sd), width=0.1)+geom_line()+geom_point()
edit ---
The data I want to plot look like this (I'm showing only the top rows). The idea is to use NDVI_mean to create the lines and NDVI_sd to create the error bars on the same graph
> NDVIdf_forplot
ID statistic value
1 1 NDVI_mean 0.052957208
2 2 NDVI_mean 0.044501794
3 3 NDVI_mean 0.077902512
4 4 NDVI_mean 0.141576609
5 5 NDVI_mean 0.653835647
6 6 NDVI_mean 0.716164870
7 7 NDVI_mean 0.386612348
8 8 NDVI_mean 0.486527816
9 9 NDVI_mean 0.226190208
10 10 NDVI_mean 0.573239754
11 1 NDVI_sd 0.008259909
12 2 NDVI_sd 0.015453091
13 3 NDVI_sd 0.099944407
14 4 NDVI_sd 0.091479545
15 5 NDVI_sd 0.223150965
16 6 NDVI_sd 0.074045394
17 7 NDVI_sd 0.058177949
18 8 NDVI_sd 0.109762451
19 9 NDVI_sd 0.019822312
20 10 NDVI_sd 0.104795771
21 1 NDVI_mean.1 0.081417705
22 2 NDVI_mean.1 0.036114126
23 3 NDVI_mean.1 0.037729680
24 4 NDVI_mean.1 0.016398037
25 5 NDVI_mean.1 0.052672604
26 6 NDVI_mean.1 0.024580946
27 7 NDVI_mean.1 0.064811390
28 8 NDVI_mean.1 0.119724256
29 9 NDVI_mean.1 0.078961665
30 10 NDVI_mean.1 0.041025489
31 1 NDVI_sd.1 0.016093458
32 2 NDVI_sd.1 0.027927592
33 3 NDVI_sd.1 0.046937888
34 4 NDVI_sd.1 0.011805721
35 5 NDVI_sd.1 0.026467984
36 6 NDVI_sd.1 0.028896611
37 7 NDVI_sd.1 0.016313583
38 8 NDVI_sd.1 0.066647683
39 9 NDVI_sd.1 0.022800589
40 10 NDVI_sd.1 0.015085673
41 1 NDVI_mean.2 0.063375514
42 2 NDVI_mean.2 0.086191853
43 3 NDVI_mean.2 0.092580942
44 4 NDVI_mean.2 0.144053635
45 5 NDVI_mean.2 0.696155509
46 6 NDVI_mean.2 0.252707792
47 7 NDVI_mean.2 0.144636380
48 8 NDVI_mean.2 0.757321462
49 9 NDVI_mean.2 0.689617575
50 10 NDVI_mean.2 0.179591653
51 1 NDVI_sd.2 0.010017152
52 2 NDVI_sd.2 0.023206464
53 3 NDVI_sd.2 0.106580902
54 4 NDVI_sd.2 0.097440674
55 5 NDVI_sd.2 0.231063744
56 6 NDVI_sd.2 0.043961963
57 7 NDVI_sd.2 0.010335935
58 8 NDVI_sd.2 0.061841114
59 9 NDVI_sd.2 0.048363788
60 10 NDVI_sd.2 0.111704779
61 1 NDVI_mean.3 0.048932939
62 2 NDVI_mean.3 0.110942174
63 3 NDVI_mean.3 0.080362752
64 4 NDVI_mean.3 0.132868790
65 5 NDVI_mean.3 0.682639604
66 6 NDVI_mean.3 0.503766225
67 7 NDVI_mean.3 0.120794820
68 8 NDVI_mean.3 0.777808416
69 9 NDVI_mean.3 0.755741184
70 10 NDVI_mean.3 0.058089687
71 1 NDVI_sd.3 0.009048781
72 2 NDVI_sd.3 0.029528930
73 3 NDVI_sd.3 0.098454753
74 4 NDVI_sd.3 0.089512544
75 5 NDVI_sd.3 0.241257647
76 6 NDVI_sd.3 0.114466677
77 7 NDVI_sd.3 0.013347437
78 8 NDVI_sd.3 0.066441491
79 9 NDVI_sd.3 0.065787691
80 10 NDVI_sd.3 0.013351357
So far this image shows how the plot is being produced. As you can see both NDVI_mean and NDVI_sd are used but this should not be the case. NDVI_sd should be used to produce geom_errorbar


valuesdf?