This is what I want to put the text label to the position where the arrows point:
These are my results:
I want to put the text label to the position where the arrows point, I used library(ggrepel).
My code is
p <- ggplot(rda_tb_fs.site, aes(RDA1, RDA2)) +
geom_vline(xintercept = 0, color = 'gray', size = 0.5) +
geom_hline(yintercept = 0, color = 'gray', size = 0.5) +
geom_segment(data = rda_tb_fs.env,
aes(x = 0,y = 0, xend = RDA1,yend = RDA2),
arrow = arrow(length = unit(0.4, 'cm'),
angle=20,
type = "open"),
size = 1,
lineend="round",
linejoin="mitre",
color='blue'
) +
geom_text_repel(data = rda_tb_fs.env,
aes(RDA1*1.06, RDA2 *1.05,
label=c("K","pH","ORP",
"HCO3","WTO")
))
I understand when RDA1 is positive then what I need is RDA1+0.1,but when RDA1 is negtive what i need is RDA1-0.1,i just don't known how to put this conditional statements into use.
this is data 1 which i made some reforms under the principle of confidentiality