I am not sure where I am going wrong.
I have encountered several errors and am attempting to troubleshoot but I'm not understanding the issue. I would appreciate it if you could help me out. My goal is to have a boxplot that has girth on y axis, ForestDiv on x axis, and the ForestDiv needs to be converted to a factor (I think I did this already, but may have screwed it up), and then ForestDiv needs to be reordered by the mean of LatDec.
 RstudioScreenshot.
RstudioScreenshot.
I have already constructed a boxplot previously, and the only updates needed are what I stated above.
Error in f():
! Aesthetics must be valid data columns. Problematic aesthetic(s): y = FactorForestDiv ~ ....
Did you mistype the name of a data column or forget to add after_stat()?
Backtrace:
- base (local) <fn>(x)
- ggplot2:::print.ggplot(x)
- ggplot2:::ggplot_build.ggplot(x)
- ggplot2 (local) by_layer(function(l, d) l$compute_aesthetics(d, plot))
- ggplot2 (local) f(l = layers[[i]], d = data[[i]])
- l$compute_aesthetics(d, plot)
- ggplot2 (local) f(..., self = self)
Join_Macro_Site %>%
 ggplot(mapping = aes(FactorForestDiv ~ fct_reorder(girth, data = FactorForestDiv, ylim(0,200), .fun = mean(LatDec)))) + 
 geom_boxplot() +
 ylim(0,200)
Error in `f()`:
! Aesthetics must be valid data columns. Problematic aesthetic(s): x = FactorForestDiv ~ .... 
Did you mistype the name of a data column or forget to add after_stat()?
Backtrace:
 1. base (local) `<fn>`(x)
 2. ggplot2:::print.ggplot(x)
 4. ggplot2:::ggplot_build.ggplot(x)
 5. ggplot2 (local) by_layer(function(l, d) l$compute_aesthetics(d, plot))
 6. ggplot2 (local) f(l = layers[[i]], d = data[[i]])
 7. l$compute_aesthetics(d, plot)
 8. ggplot2 (local) f(..., self = self)
Join_Macro_Site %>%
 ggplot(mapping = aes() + 
 geom_boxplot() +
 FactorForDiv <- factor(FactorForDiv, levels = data(order(mean(LatDec)), "ForestDiv", levels(ForestDiv)
 ylim(0,200)
Error: unexpected symbol in:
"FactorForDiv <- factor(FactorForDiv, levels = data(order(mean(LatDec)), "ForestDiv", levels(ForestDiv)
ylim"
Join_Macro_Site %>%
 ggplot(mapping = aes() + 
 geom_boxplot() +
 Join_Macro_Site$ForestDiv <- factor(Join_Macro_Site$ForestDiv, levels = Join_Macro_Site[order(Join_Macro_Site$LatDec), "ForestDiv"])
 levels(Join_Macro_Site$ForestDiv)
Error: unexpected symbol in:
"Join_Macro_Site$ForestDiv <- factor(Join_Macro_Site$ForestDiv, levels = Join_Macro_Site[order(Join_Macro_Site$LatDec), "ForestDiv"])
levels"
Join_Macro_Site %>%
 ggplot(mapping = aes() + 
 geom_boxplot() +
 Join_Macro_Site$ForestDiv <- factor(Join_Macro_Site$ForestDiv, levels = Join_Macro_Site[order(Join_Macro_Site$LatDec), "ForestDiv"])
 levels(Join_Macro_Site$ForestDiv) %>%
Error: unexpected symbol in:
"Join_Macro_Site$ForestDiv <- factor(Join_Macro_Site$ForestDiv, levels = Join_Macro_Site[order(Join_Macro_Site$LatDec), "ForestDiv"])
levels"
Join_Macro_Site %>%
 ggplot(mapping = aes() + 
 geom_boxplot() +
 Join_Macro_Site$ForestDiv <- factor(Join_Macro_Site$ForestDiv, levels = Join_Macro_Site[order(Join_Macro_Site$LatDec), "ForestDiv"]), levels(Join_Macro_Site$ForestDiv) %>%
 ylim(0,200)
Error: Incomplete expression: Join_Macro_Site %>%
ggplot(mapping = aes() + 
geom_boxplot() +
Join_Macro_Site$ForestDiv <- factor(Join_Macro_Site$ForestDiv, levels = Join_Macro_Site[order(Join_Macro_Site$LatDec), "ForestDiv"]), levels(Join_Macro_Site$ForestDiv) %>%
ylim(0,200)
 
    