Skip to content

Commit

Permalink
added to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
trinker committed Sep 20, 2016
1 parent 26222a2 commit fe50a2a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NEWS
NEWS
====

Versioning
Expand All @@ -10,14 +10,14 @@ Releases will be numbered with the following semantic versioning format:

And constructed with the following guidelines:

* Breaking backward compatibility bumps the major (and resets the minor
* Breaking backward compatibility bumps the major (and resets the minor
and patch)
* New additions without breaking backward compatibility bumps the minor
* New additions without breaking backward compatibility bumps the minor
(and resets the patch)
* Bug fixes and misc changes bumps the patch


numform0.0.1
numform 0.0.1
----------------------------------------------------------------

This package is...
5 changes: 3 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ report <- function(mod, stat = NULL, digits = c(0, 2, 2)) {
stat <- if (is.null(stat)) stat <- names(mod[["statistic"]])
sprintf(
"%s(%s) = %s, %s",
stat,
gsub('X-squared', '&Chi;<sup>2</sup>', stat),
paste(f_num(mod[["parameter"]], digits[1]), collapse = ", "),
f_num(mod[["statistic"]], digits[2]),
f_percent(mod[["p.value"]], digits = digits[3])
Expand All @@ -98,6 +98,7 @@ This enables in-text usage as well. First set up the models in a code chunk:

```{r}
mymod <- oneway.test(count ~ spray, InsectSprays)
mymod2 <- chisq.test(matrix(c(12, 5, 7, 7), ncol = 2))
```

And then use `r rinline("report(mymod)")` resulting in a report that looks like this: `r report(mymod)`
And then use `r rinline("report(mymod)")` resulting in a report that looks like this: `r report(mymod)`. For &Chi;<sup>2</sup> using proper HTML leads to `r report(mymod2)`.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ We can build a function to report model statistics:
stat <- if (is.null(stat)) stat <- names(mod[["statistic"]])
sprintf(
"%s(%s) = %s, %s",
stat,
gsub('X-squared', '&Chi;<sup>2</sup>', stat),
paste(f_num(mod[["parameter"]], digits[1]), collapse = ", "),
f_num(mod[["statistic"]], digits[2]),
f_percent(mod[["p.value"]], digits = digits[3])
Expand All @@ -101,12 +101,15 @@ We can build a function to report model statistics:

report(chisq.test(matrix(c(12, 5, 7, 7), ncol = 2)))

## [1] "X-squared(1) = .64, .42%"
## [1] "&Chi;<sup>2</sup>(1) = .64, .42%"

This enables in-text usage as well. First set up the models in a code
chunk:

mymod <- oneway.test(count ~ spray, InsectSprays)
mymod2 <- chisq.test(matrix(c(12, 5, 7, 7), ncol = 2))

And then use <code class="r">`` `r report(mymod)` ``</code> resulting in
a report that looks like this: F(5, 30) = 36.07, .00%
a report that looks like this: F(5, 30) = 36.07, .00%. For
&Chi;<sup>2</sup> using proper HTML leads to &Chi;<sup>2</sup>(1) = .64,
.42%.

0 comments on commit fe50a2a

Please sign in to comment.