[R] Creating hanging bar plot in r from dplyr

Scott Colwell @co|we|| @end|ng |rom uogue|ph@c@
Sat Apr 20 18:49:54 CEST 2019


I am trying to figure out how to create a hanging bar plot from dplyr.
I have used dplyr as follows:
table4 <- cr %>%
  group_by(samp.N, RSQ) %>%
  summarize(
    MRB_uc = mean(CF.F1F2/0.40*100)-100,
    MRB_sb = mean(SBC.F1F2.Alpha/0.40*100) - 100,
    MRB_bp = mean(BPC.F1F2.Alpha/0.40*100) - 100
  )
which provides me with this:
   samp.N   RSQ MRB_uc MRB_sb MRB_bp
    <dbl> <dbl>  <dbl>  <dbl>  <dbl>
1     50   0.3   1.42  37.6   37.6
 2     50   0.4   8.61  43.1   43.1
 3     50   0.5   7.41  31.6   31.6
 4     50   0.6   5.06  21.5   21.5
 5     50   0.7   3.38  14.1   14.1
 6     50   0.8  -1.07   5.16   5.16
7    100   0.3  -6.41  40.3   40.3
 8    100   0.4 -10.6   21.0   21.0
 9    100   0.5  -9.02  13.2   13.2
10    100   0.6  -9.85   5.14   5.14
11    100   0.7  -7.94   2.08   2.08
12    100   0.8  -4.81   1.28   1.28
What I want to do is create a hanging bar plot with the x-axis being samp.N value by RSQ value. The bars are then values of MRB_uc, MRB_sb, and MRB_bp. Given some values are negative, some bars will be above zero and others below (hence the hanging bar plot)
I don't have any code yet as I am completely unfamiliar with how to do this. Any suggestions would be really appreciated.
Thank you!
Scott




--
Scott R. Colwell, PhD


	[[alternative HTML version deleted]]



More information about the R-help mailing list