s6juncheng / ggpval Goto Github PK
View Code? Open in Web Editor NEWAdd statistical test or annotation to your ggplot2 plots,
Home Page: https://s6juncheng.github.io/ggpval/
Add statistical test or annotation to your ggplot2 plots,
Home Page: https://s6juncheng.github.io/ggpval/
When I run pval_star on your example data set (actually on any data set), it throws up the error:
Error in annotation[i, ] : incorrect number of dimensions
ππ½ I maintain the cran checks badges. Please change to the new cran checks badge URL (e.g., https://badges.cranchecks.info/worst/dplyr.svg
). Old badges at (e.g. https://cranchecks.info/badges/worst/dplyr
) will be unavailable as of Jan 1st 2023.
Hello!
for example:
plane_p <- add_pval(plane_p, pairs = list(c(1, 2)), test = "t.test")
How should I specify the parameters used by t.testοΌ
I want to specify
t.test(..., alternative = "less")
Thanks very much!
I quickly made a pkgdown
website for ggpval
, and I think it'll help increase its visibility. Here is a preview.
I can help you set up a custom url and to setup travis_ci()
if you're interested.
Would be great to have an option for horizontal based plots
Detailed procedure: http://r-pkgs.had.co.nz/release.html
Dear ggpval-team,
It is me again. I have another issue. I asked my question on Stackoverflow here: https://stackoverflow.com/questions/70740117/issues-with-ggpval-package-in-r
It seems that textsize is not working. Is that correct?
Thank you
Sarah
export function format_pval. If annotations are pvalue, add "parse=T"
Thanks for this package! I use {plotly} often using ggplotly(p)
and was disappointed when {ggsignif} was unable to convert. Thankfully, {ggpval} has no such issue, however the styling of the text (italic 'P') does not carry over.
I appreciate that this isn't any fault of {ggpval} but in anticipation of this use case, how about an optional argument to disable styling of the text, so that it goes through ggplotly()
verbatim?
# R.version.string
# [1] "R version 3.6.1 (2019-07-05)"
# packageVersion("ggpval")
# [1] β0.2.3β
library(ggplot2)
plt <- ggplot(mtcars, aes(factor(gear), mpg)) +
geom_boxplot() +
geom_jitter()
p <- ggpval::add_pval(plt, pairs = list(c(1, 2)), test = "t.test")
plotly::ggplotly(p)
# Create a dataframe
df <- data.frame(A = runif(5),
B = runif(5),
G = c("Group1", "Group2", "Group3", "Group4", "Group5"))
# Melt the dataframe to be used for ggplot2
df_melt <- reshape2::melt(df, id.vars = "G")
# Create a list of p-values
# Those values are the real ones that I have in my data
# I just modified them after the calculations by using case_when() with paste() as:
# (1) every p values lower than 0.001 is shown as "p < 0.001"
# (2) all the other values are shown as "p = xxx"
# As shown on GitHub, annotation option needs a list
pvalues <- list("p < 0.001", "p < 0.001", "'p = 0.123'", "p = 0.813", "p = 0.043")
# Create the plot
library(ggplot2)
library(ggpval)
bar_plot <- ggplot(data = df_melt, aes(x = variable, y = value, fill = variable)) + geom_bar(stat = "identity", position = "dodge") +
facet_grid(.~G) +
theme_bw() +
scale_y_continuous(labels = scales::percent_format(), limits = c(0, 1.05))
# Add p-values
add_pval(bar_plot, pairs = list(c(1, 2)), annotation = pvalues)
Dear ggpval-team,
As you can see, Group 4 and Group 5 looks strange. Not Group 3 as I wrapped the quotations with the character string (I found that by chance as I got a parse issue 2 minutes before that part). My question is: can we avoid that extra step? Or am I doing something wrong?
EDIT: sorry, by also putting the character string for Group 4 and Group 5, it does not work for them...
Thank you for your help
Sarah
System information:
R Version: R version 4.1.1 (2021-08-10)
R Studio Version: 1.4.1717
OS: Ubuntu 20.04.3 LTS
Platform: x86_64-pc-linux-gnu (64-bit)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.