Comments (3)
library(ggplot2)
library(statsExpressions)
#> Registered S3 methods overwritten by 'lme4':
#> method from
#> cooks.distance.influence.merMod car
#> influence.merMod car
#> dfbeta.influence.merMod car
#> dfbetas.influence.merMod car
df <- tibble(x = rnorm(100))
df_res <- expr_t_onesample(df, x, output = "dataframe")
#> New names:
#> * ci.width -> ci.width...2
#> * ci.width -> ci.width...8
df_res %<>% dplyr::mutate(expr_sub = list(expr_t_onesample(df, x, type = "p")),
expr_cap = list(expr_t_onesample(df, x, type = "bf")))
#> New names:
#> * ci.width -> ci.width...2
#> * ci.width -> ci.width...8
ggplot(df, aes(x)) +
geom_histogram(alpha = 0.5) +
labs(
subtitle = df_res$expr_sub[[1]],
caption = df_res$expr_cap[[1]]
)
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Created on 2021-01-23 by the reprex package (v0.3.0)
from statsexpressions.
expr_template
can itself return this as an additional column in a dataframe
this will also avoid having to use substitute
and using a list to enter the expression components
from statsexpressions.
library(tidyverse)
df <- data.frame(
term = c("term-1, term-2"),
p.value = c(0.001, 0.067)
)
(df_label <-
df %>%
rowwise() %>%
mutate(label = list(parse(text = paste0("list(~italic(p)=='", p.value, "')")))))
#> # A tibble: 2 x 3
#> # Rowwise:
#> term p.value label
#> <chr> <dbl> <list>
#> 1 term-1, term-2 0.001 <expression>
#> 2 term-1, term-2 0.067 <expression>
df_label$label
#> [[1]]
#> expression(list(~italic(p)=='0.001'))
#>
#> [[2]]
#> expression(list(~italic(p)=='0.067'))
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
labs(subtitle = df_label$label[[1]],
caption = df_label$label[[2]])
Created on 2021-01-26 by the reprex package (v0.3.0.9001)
from statsexpressions.
Related Issues (20)
- Guidance for using statsExpressions to customize plots?
- In case of `NA`, show it in the label instead of a blank space
- revdep issues with insight HOT 1
- Use `safe_model_parameters()` in `tidy_model_parameters()` instead?
- Avoid duplicating examples
- Don't include CIs in `centrality_description()` by default
- Exact p-value calculation using Wilcoxon rank sum test HOT 1
- DRY test dataset
- Stop converting to factors
- Revep check failure for {insight} HOT 4
- i wonder if `pairwise_comparisons` can do Tukey's HSD? HOT 1
- Use `{roxyglobals}` HOT 1
- Rename `stats_type_switch()` to `extract_stats_type()`
- wilcoxon test default parameters modification HOT 1
- Fix failures on R-devel
- Necessity of patch-level version bumps in dependencies HOT 1
- Introduce parameters to pass extra arguments
- ggbarstats does not show subtitle when paired = TRUE (for more than two groups) HOT 4
- _performance_ revdep-check issues HOT 2
- Switch to MIT licence
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statsexpressions.