[R-gregmisc-users] SF.net SVN: r-gregmisc:[1759] trunk/gtools
Brought to you by:
warnes
From: <wa...@us...> - 2013-12-23 16:04:06
|
Revision: 1759 http://sourceforge.net/p/r-gregmisc/code/1759 Author: warnes Date: 2013-12-23 16:04:03 +0000 (Mon, 23 Dec 2013) Log Message: ----------- Add stars.pval() function to convert p-values into significance symbols. Modified Paths: -------------- trunk/gtools/NAMESPACE Added Paths: ----------- trunk/gtools/R/stars.pval.R trunk/gtools/man/stars.pval.Rd Modified: trunk/gtools/NAMESPACE =================================================================== --- trunk/gtools/NAMESPACE 2013-12-18 14:33:28 UTC (rev 1758) +++ trunk/gtools/NAMESPACE 2013-12-23 16:04:03 UTC (rev 1759) @@ -31,6 +31,7 @@ setTCPNoDelay, smartbind, sprint, + stars.pval, strmacro ) Added: trunk/gtools/R/stars.pval.R =================================================================== --- trunk/gtools/R/stars.pval.R (rev 0) +++ trunk/gtools/R/stars.pval.R 2013-12-23 16:04:03 UTC (rev 1759) @@ -0,0 +1,8 @@ +stars.pval <- function(p.value) + { + unclass( + symnum(p.value, corr = FALSE, na = FALSE, + cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1), + symbols = c("***", "**", "*", ".", " ")) + ) + } Added: trunk/gtools/man/stars.pval.Rd =================================================================== --- trunk/gtools/man/stars.pval.Rd (rev 0) +++ trunk/gtools/man/stars.pval.Rd 2013-12-23 16:04:03 UTC (rev 1759) @@ -0,0 +1,44 @@ +\name{stars.pval} +\alias{stars.pval} +\title{ +Generate significance stars from p-values +} +\description{ + Generate significance stars (e.g. '***', '**', '*', '+') from + p-values using R's standard definitions. +} +\usage{ +stars.pval(p.value) +} +\arguments{ + \item{p.value}{numeric vector of p-values} +} +\details{ + Mapping from p-value ranges to symbols: + \describe{ + \item{0 - 0.001}{'***'} + \item{0.001 - 0.01}{'**'} + \item{0.01 - 0.05}{'*'} + \item{0.05 - 0.1}{'+'} + \item{0.1 - 1.0}{'' (No symbol)} + } +} +\value{ + A character vector containing the same number of elements as + \code{p-value}, with an attribute "legend" providing the conversion + pattern. +} +\author{ + Gregory R. Warnes \email{gr...@wa...} +} +\seealso{ + \code{\link[stats]{symnum}} +} +\examples{ +p.val <- c(0.0004, 0.0015, 0.013, 0.044, 0.067, 0.24) +stars.pval(x) +} +% Add one or more standard keywords, see file 'KEYWORDS' in the +% R documentation directory. +\keyword{ ~kwd1 } +\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |