Skip to content

Commit

Permalink
getting ready for CRAN (#215)
Browse files Browse the repository at this point in the history
* re-export data helpers from datawizard

- remove report's copies of these functions
- re-exporting to be conservative; if everyone agrees, happy to stop exporting them but that would be a breaking change

* also remove text formatting helpers

* fix most of the tests

differences in values are due to changes in effectsize
  • Loading branch information
IndrajeetPatil authored Jan 23, 2022
1 parent aebde28 commit 8728043
Show file tree
Hide file tree
Showing 33 changed files with 136 additions and 703 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-18.04, r: 'release'}
- {os: windows-latest, r: 'oldrel'}
- {os: macOS-latest, r: 'oldrel'}
#- {os: macOS-latest, r: 'oldrel'}
- {os: ubuntu-18.04, r: 'oldrel'}
- {os: ubuntu-18.04, r: '3.6.0'}
- {os: ubuntu-18.04, r: '3.5.0'}
Expand Down
12 changes: 5 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ URL: https://easystats.github.io/report/
BugReports: https://github.com/easystats/report/issues
Imports:
bayestestR (>= 0.11.5),
effectsize (>= 0.5.0.1),
insight (>= 0.14.5),
parameters (>= 0.15.0),
effectsize (>= 0.6.0),
insight (>= 0.15.0),
parameters (>= 0.16.0),
performance (>= 0.8.0),
datawizard (>= 0.2.1),
datawizard (>= 0.2.2),
stats,
tools,
utils
Expand All @@ -61,7 +61,7 @@ Suggests:
lavaan,
lme4,
logspline,
poorman,
dplyr,
rmarkdown,
rstanarm,
spelling,
Expand All @@ -79,7 +79,6 @@ Collate:
'format_citation.R'
'format_formula.R'
'format_model.R'
'format_text.R'
'utils_combine_tables.R'
'report.lm.R'
'report.MixMod.R'
Expand Down Expand Up @@ -119,7 +118,6 @@ Collate:
'report_sample.R'
'report_statistics.R'
'report_table.R'
'utils_data.R'
'utils_error_message.R'
'utils_grouped_df.R'
Roxygen: list(markdown = TRUE)
Expand Down
16 changes: 3 additions & 13 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,10 @@ export(cite_citation)
export(cite_easystats)
export(cite_packages)
export(clean_citation)
export(data_addprefix)
export(data_addsuffix)
export(data_findcols)
export(data_remove)
export(data_rename)
export(data_reorder)
export(format_algorithm)
export(format_citation)
export(format_formula)
export(format_model)
export(format_text)
export(is.report)
export(report)
export(report_date)
Expand All @@ -297,9 +290,6 @@ export(report_story)
export(report_system)
export(report_table)
export(report_text)
export(text_concatenate)
export(text_fullstop)
export(text_lastchar)
export(text_paste)
export(text_remove)
export(text_wrap)
import(datawizard)
import(effectsize)
import(insight)
26 changes: 26 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
# report 0.3.6

BREAKING CHANGES

* The following functions have now been removed from `report` and now live in [`datawizard`](https://easystats.github.io/datawizard/reference/index.html) package:

Data wrangling helpers:

- `data_addprefix()`
- `data_addsuffix()`
- `data_findcols()`
- `data_remove()`
- `data_rename()`
- `data_reorder()`

Text formatting helpers:

- `format_text()`
- `text_fullstop()`
- `text_lastchar()`
- `text_concatenate()`
- `text_paste()`
- `text_remove()`
- `text_wrap()`

MAJOR CHANGES

* Separated sex and gender into different searches/columns
* Sex is reported % female, % male, % other, % missing if any cases are missing
* Gender is reported % Women, % Men, % Non-Binary, % missing if any cases are missing
Expand Down
117 changes: 0 additions & 117 deletions R/format_text.R

This file was deleted.

4 changes: 4 additions & 0 deletions R/report.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
#' \item [report.default()]
#' }
#'
#' @import datawizard
#' @import effectsize
#' @import insight
#'
#' @examples
#' library(report)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/report.data.frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#' summary(as.data.frame(r))
#'
#' # grouped analysis using `{dplyr}` package
#' if (require("poorman")) {
#' if (require("dplyr")) {
#' r <- iris %>%
#' group_by(Species) %>%
#' report()
Expand Down
22 changes: 11 additions & 11 deletions R/report_participants.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
#'
#' # Years of education (relative to high school graduation)
#' data$Education <- c(0, 8, -3, -5, 3, 5)
#' report_participants(data, age = "Age", sex = "Sex", gender = "Gender",
#' education = "Education")
#' report_participants(data,
#' age = "Age", sex = "Sex", gender = "Gender",
#' education = "Education"
#' )
#'
#' # Education as factor
#' data$Education2 <- c(
Expand Down Expand Up @@ -187,7 +189,7 @@ report_participants <- function(data,
)
age <- "Age"
sex <- "Sex"
gender <-"Gender"
gender <- "Gender"
education <- "Education"
}

Expand Down Expand Up @@ -227,8 +229,7 @@ report_participants <- function(data,
insight::format_value(100 - length(data[[sex]][tolower(data[[sex]]) %in% c("male", "m", "female", "f")]) / nrow(data) * 100, digits = digits),
"% other"
)
}
else {
} else {
paste0(
"Sex: ",
insight::format_value(length(data[[sex]][tolower(data[[sex]]) %in% c("female", "f")]) / nrow(data) * 100, digits = digits),
Expand All @@ -239,7 +240,7 @@ report_participants <- function(data,
"% other, ",
insight::format_value(length(data[[sex]][tolower(data[[sex]]) %in% c(NA)]) / nrow(data) * 100),
"% missing"
)
)
}

text_gender <- if (all(is.na(data[[gender]]))) {
Expand All @@ -254,8 +255,7 @@ report_participants <- function(data,
insight::format_value(100 - length(data[[gender]][tolower(data[[gender]]) %in% c("woman", "w", "man", "m")]) / nrow(data) * 100),
"% non-binary"
)
}
else {
} else {
paste0(
"Gender: ",
insight::format_value(length(data[[gender]][tolower(data[[gender]]) %in% c("woman", "w")]) / nrow(data) * 100, digits = digits),
Expand Down Expand Up @@ -303,8 +303,8 @@ report_participants <- function(data,
" participants (",
ifelse(text_age == "", "", text_age),
ifelse(text_sex == "", "", paste0(ifelse(text_age == "", "", "; "), text_sex)),
ifelse(text_gender == "", "", paste0(ifelse(text_age == "" & text_sex=="", "", "; "), text_gender)),
ifelse(text_education == "", "", paste0(ifelse(text_age == "" & text_sex == "" & text_gender== "","", "; "), text_education)),
ifelse(text_gender == "", "", paste0(ifelse(text_age == "" & text_sex == "", "", "; "), text_gender)),
ifelse(text_education == "", "", paste0(ifelse(text_age == "" & text_sex == "" & text_gender == "", "", "; "), text_education)),
")"
)
}
Expand Down Expand Up @@ -342,7 +342,7 @@ report_participants <- function(data,
}

#' @keywords internal
.find_gender_in_data <-function(data) {
.find_gender_in_data <- function(data) {
if ("Gender" %in% colnames(data)) {
"Gender"
} else if ("gender" %in% colnames(data)) {
Expand Down
Loading

0 comments on commit 8728043

Please sign in to comment.