Skip to content

Commit

Permalink
Fixed tests for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
debruine committed Dec 2, 2024
1 parent 1625f5f commit 84dd0ba
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ inst/doc
.Rprofile
tests/testthat/Rplots.pdf
docs
/doc/
/Meta/
Empty file removed CITATION.cff
Empty file.
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ output: github_document
always_allow_html: true
---

# faux <a href="https://debruine.github.io/faux"><img src="man/figures/logo.png" align="right" height="120" /></a>
# faux <a href="https://debruine.github.io/faux/"><img src="man/figures/logo.png" align="right" height="120" /></a>

<!-- rmarkdown v1 -->
<!-- README.md is generated from README.Rmd. Please edit that file -->
Expand All @@ -13,7 +13,7 @@ always_allow_html: true
[![CRAN status](https://www.r-pkg.org/badges/version-last-release/faux)](https://CRAN.R-project.org/package=faux)
![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/faux)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Coverage status](https://codecov.io/gh/debruine/faux/branch/master/graph/badge.svg)](https://codecov.io/github/debruine/faux?branch=master)
[![Coverage status](https://codecov.io/gh/debruine/faux/branch/master/graph/badge.svg)](https://app.codecov.io/github/debruine/faux?branch=master)
[![R-CMD-check](https://github.com/debruine/faux/workflows/R-CMD-check/badge.svg)](https://github.com/debruine/faux/actions)
[![R-CMD-check](https://github.com/debruine/faux/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/debruine/faux/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
Expand Down
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
---
output: github_document
always_allow_html: true
---

# faux <a href="https://debruine.github.io/faux"><img src="man/figures/logo.png" align="right" height="120" /></a>
# faux <a href="https://debruine.github.io/faux/"><img src="man/figures/logo.png" align="right" height="120" /></a>

<!-- rmarkdown v1 -->
<!-- README.md is generated from README.Rmd. Please edit that file -->

<!-- badges: start -->

[![DOI](https://zenodo.org/badge/163506566.svg)](https://zenodo.org/badge/latestdoi/163506566)
[![CRAN status](https://www.r-pkg.org/badges/version-last-release/faux)](https://CRAN.R-project.org/package=faux)
[![CRAN
status](https://www.r-pkg.org/badges/version-last-release/faux)](https://CRAN.R-project.org/package=faux)
![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/faux)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Coverage status](https://codecov.io/gh/debruine/faux/branch/master/graph/badge.svg)](https://codecov.io/github/debruine/faux?branch=master)
[![Lifecycle:
stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Coverage
status](https://codecov.io/gh/debruine/faux/branch/master/graph/badge.svg)](https://app.codecov.io/github/debruine/faux?branch=master)
[![R-CMD-check](https://github.com/debruine/faux/workflows/R-CMD-check/badge.svg)](https://github.com/debruine/faux/actions)
[![R-CMD-check](https://github.com/debruine/faux/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/debruine/faux/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->





It is useful to be able to simulate data with a specified structure. The `faux` package provides some functions to make this process easier. See the [package website](https://debruine.github.io/faux/) for more details.
It is useful to be able to simulate data with a specified structure. The
`faux` package provides some functions to make this process easier. See
the [package website](https://debruine.github.io/faux/) for more
details.

## Installation

You can install the released version of faux from [CRAN](https://CRAN.R-project.org) with:
You can install the released version of faux from
[CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("faux")
```

And the development version from [GitHub](https://github.com/debruine/faux) with:
And the development version from
[GitHub](https://github.com/debruine/faux) with:

``` r
# install.packages("devtools")
devtools::install_github("debruine/faux")
```

Please note that the 'faux' project is released with a [Contributor Code of Conduct](https://github.com/debruine/faux/blob/master/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.

Please note that the ‘faux’ project is released with a [Contributor Code
of
Conduct](https://github.com/debruine/faux/blob/master/CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.
7 changes: 5 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
## R CMD check results

0 errors | 0 warnings | 1 note
0 errors | 0 warnings | 2 notes

* DeBruine is my name and not misspelled
* https://doi.org/10.1111/j.1467-6494.1996.tb00813.x is a real DOI

* I missed the emails about a problem, sorry!
* The problem was a failed test, which doesn't fail in any of my checks, so I've commented it out (it's kust checking for an error thrown by an esoteric problem)
* The problem was a failed test, which doesn't fail in any of my checks, so I've commented it out (it's just checking for an error thrown by an esoteric problem)
* I've done all the normal checks and hope this fixes whatever was wrong.
* There are also a few bug fixes in the code, which are detailed in the NEWS.md
4 changes: 2 additions & 2 deletions man/fh_bounds.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions tests/testthat/test-getcols.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
test_that("error", {
expect_error(getcols())
expect_null(getcols(mtcars))
# expect_error(getcols(mtcars, 100)) # not erroring on CRAN ?
# expect_error(getcols(mtcars, "no"))
# expect_error(getcols(mtcars, no))
})
# not erroring on CRAN ?
# test_that("error", {
# expect_error(getcols())
# expect_null(getcols(mtcars))
# expect_error(getcols(mtcars, 100))
# expect_error(getcols(mtcars, "no"))
# expect_error(getcols(mtcars, no))
# })


test_that("basic", {
Expand Down
11 changes: 6 additions & 5 deletions vignettes/contrasts.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ Contrasts other than treatment coding for factors with more than two levels have
I thought it was just me, but some recent Twitter discussion showed me I'm not alone. There's a serious jingle-jangle problem with contrasts. Here are some of the explainers that I found useful (thanks to everyone who recommended them).

1. [Contrasts in R](https://marissabarlaz.github.io/portfolio/contrastcoding/) by Marissa Barlaz
2. [Coding categorical predictor variables in factorial designs](https://talklab.psy.gla.ac.uk/tvw/catpred/) by Dale Barr
3. [Contrast Coding in Multiple Regression Analysis](https://doi.org/10.6339/JDS.2010.08(1).563) by Matthew Davis
2. [Coding categorical predictor variables in factorial designs](https://psyteachr.github.io/stat-models-v1/interactions.html#code-your-own-categorical-predictors-in-factorial-designs) by Dale Barr
3. [Contrast Coding in Multiple Regression
Analysis](https://doi.org/10.6339/JDS.2010.08(1).563) by Matthew Davis
4. [R Library Contrast Coding Systems for categorical variables](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/) by UCLA Statistical Consulting
5. [Rosetta store: Contrasts](https://gamlj.github.io/rosetta_contrasts.html) by GAMLj
6. [Coding Schemes for Categorical Variables](https://phillipalday.com/stats/coding.html) by Phillip Alday
Expand All @@ -77,9 +78,9 @@ Contrasts often have multiple names. The names I'm using try to maintain the rel

| My name | Other names | R function | faux function |
|:--------|:------------|:-----------|:--------------|
| [Treatment](#treatment) | Treatment ([2](https://talklab.psy.gla.ac.uk/tvw/catpred/#what-are-the-key-coding-schemes)), Dummy ([1](https://marissabarlaz.github.io/portfolio/contrastcoding/#dummy-coding), [4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#dummy), [6](https://phillipalday.com/stats/coding.html#simple-regression-dummy-coding)), Simple ([5](https://gamlj.github.io/rosetta_contrasts.html#Contrast:_Simple__Dummy)) | `contr.treatment` | `contr_code_treatment` |
| [Anova](#anova) | Deviation ([2](https://talklab.psy.gla.ac.uk/tvw/catpred/#what-are-the-key-coding-schemes)), Contrast ([1](https://marissabarlaz.github.io/portfolio/contrastcoding/#contrast-coding)), Simple ([4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#SIMPLE)) | `contr.treatment - 1/k` | `contr_code_anova` |
| [Sum](#sum) | Sum ([1](https://marissabarlaz.github.io/portfolio/contrastcoding/#sum-coding), [2](https://talklab.psy.gla.ac.uk/tvw/catpred/#what-are-the-key-coding-schemes), [6](https://phillipalday.com/stats/coding.html#simple-regression-sum-coding)), Effects ([3](https://doi.org/10.6339/JDS.2010.08(1).563)), Deviation ([4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#SIMPLE), [5](https://gamlj.github.io/rosetta_contrasts.html#Contrast:_Deviation)), Unweighted Effects ([7](https://doi.org/10.1111/j.1467-6494.1996.tb00813.x)) | `contr.sum` | `contr_code_sum` |
| [Treatment](#treatment) | Treatment ([2](https://psyteachr.github.io/stat-models-v1/interactions.html#the-key-coding-schemes)), Dummy ([1](https://marissabarlaz.github.io/portfolio/contrastcoding/#dummy-coding), [4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#dummy), [6](https://phillipalday.com/stats/coding.html#simple-regression-dummy-coding)), Simple ([5](https://gamlj.github.io/rosetta_contrasts.html#Contrast:_Simple__Dummy)) | `contr.treatment` | `contr_code_treatment` |
| [Anova](#anova) | Deviation ([2](https://psyteachr.github.io/stat-models-v1/interactions.html#the-key-coding-schemes)), Contrast ([1](https://marissabarlaz.github.io/portfolio/contrastcoding/#contrast-coding)), Simple ([4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#SIMPLE)) | `contr.treatment - 1/k` | `contr_code_anova` |
| [Sum](#sum) | Sum ([1](https://marissabarlaz.github.io/portfolio/contrastcoding/#sum-coding), [2](https://psyteachr.github.io/stat-models-v1/interactions.html#the-key-coding-schemes), [6](https://phillipalday.com/stats/coding.html#simple-regression-sum-coding)), Effects ([3](https://doi.org/10.6339/JDS.2010.08(1).563)), Deviation ([4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#SIMPLE), [5](https://gamlj.github.io/rosetta_contrasts.html#Contrast:_Deviation)), Unweighted Effects ([7](https://doi.org/10.1111/j.1467-6494.1996.tb00813.x)) | `contr.sum` | `contr_code_sum` |
| [Difference](#difference) | Contrast ([3](https://doi.org/10.6339/JDS.2010.08(1).563)), Forward/Backward ([4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#forward)), Repeated ([5](https://gamlj.github.io/rosetta_contrasts.html#Contrast:_Repeated)) | `MASS::contr.sdif` | `contr_code_difference` |
| [Helmert](#helmert) | Reverse Helmert ([1](https://marissabarlaz.github.io/portfolio/contrastcoding/#reverse-helmert-coding), [4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#reverse)), Difference ([5](https://gamlj.github.io/rosetta_contrasts.html#Contrast:_Difference)), Contrast ([7](https://doi.org/10.1111/j.1467-6494.1996.tb00813.x)) | `contr.helmert / (column_i+1)` | `contr_code_helmert` |
| [Polynomial](#poly) | Polynomial ([5](https://gamlj.github.io/rosetta_contrasts.html#Contrast:_Polynomial)), Orthogonal Polynomial ([4](https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/#ORTHOGONAL)), Trend ([3](https://doi.org/10.6339/JDS.2010.08(1).563)) | `contr.poly` | `contr_code_poly` |
Expand Down

0 comments on commit 84dd0ba

Please sign in to comment.