# NOT RUN {
# Case 1: ggbash() with no argument
ggbash() # ggbash() enters into an interactive ggbash session
# Case 2: with a character arugment
## parentheses and commas become optional
ggbash("gg iris + point Sepal.W Sepal.L color=Species ")
ggbash("gg iris + point Sepal.W, Sepal.L, color=Species ")
ggbash("gg(iris) + point(Sepal.W, Sepal.L, color=Species)")
## all of the above work
# Case 3: with a short-ggplot2 command
## sm: geom_smooth
ggbash(gg(iris, Sepal.W, Sepal.L, c=Sp) + point + sm(method="lm", se=FALSE)
+ theme(a.txt(sz=25, face="bold"), l.pos("bottom")) )
## if you prefer more ggplot2-compliant syntax
ggbash(ggplot(iris, Sepal.Width, Sepal.Length, colour = Species) +
geom_point() + geom_smooth(method = "lm", se = FALSE) +
theme(axis.text(size=25, face="bold"), legend.position("bottom")) )
## or if you prefer an extreme short syntax
ggbash(g(iris, Sepal.W, S, c=Sp) + p + sm(mth="lm", se=FALSE)
+ theme(a.tx(s=25, f="bold"), l.pos("bottom")))
## S ambiguously matches to Sepal.Length, Sepal.Width, Species.
## Since the Sepal.Length has the smallest column index, it's selected
# Case 4: dataset piped from dplyr/tidyr
iris %>%
mutate(my_long_descriptive_column_name = Sepal.Width,
other_useful_informative_name = Sepal.Length) %>%
ggbash(gg() + point(my, other))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab