Skip to content

Commit

Permalink
CRAN peparation
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-jedrusiak committed Aug 8, 2023
1 parent 81a4e82 commit 9496aae
Show file tree
Hide file tree
Showing 18 changed files with 107 additions and 102 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
^\.lintr$
^\.covrignore$
^\.vscode$
^cran-comments\.md$
^CRAN-SUBMISSION$
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 1.0.0
Date: 2023-08-07 12:57:06 UTC
SHA: 49620267b928e590dd5e1dbda7bb4a97d03d1f0d
38 changes: 19 additions & 19 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
Package: mtscr
Type: Package
Title: Multidimentional Top Scoring for Creativity Research
Version: 0.1.0
Title: Multidimensional Top Scoring for Creativity Research
Version: 1.0.0
Authors@R: c(
person(
"Jakub", "Jędrusiak",
email = "kuba23031999@gmail.com",
role = c("aut", "cre", "cph"),
comment = c(
ORCID = "0000-0002-6481-8210",
affiliation = "University of Wrocław"
)
),
person(
"Boris", "Forthmann",
email = "boris.forthmann@uni-muenster.de",
Expand All @@ -12,15 +21,6 @@ Authors@R: c(
affiliation = "University of Münster"
)
),
person(
"Maciej", "Karwowski",
email = "maciej.karwowski@uwr.edu.pl",
role = "aut",
comment = c(
ORCID = "0000-0001-6974-1673",
affiliation = "University of Wrocław"
)
),
person(
c("Roger", "E."), "Beaty",
email = "rebeaty@psu.edu",
Expand All @@ -31,17 +31,17 @@ Authors@R: c(
)
),
person(
"Jakub", "Jędrusiak",
email = "kuba23031999@gmail.com",
role = c("aut", "cre"),
"Maciej", "Karwowski",
email = "maciej.karwowski@uwr.edu.pl",
role = "aut",
comment = c(
ORCID = "0000-0002-6481-8210",
ORCID = "0000-0001-6974-1673",
affiliation = "University of Wrocław"
)
)
)
Description: R implementation of Multidimentional Top Scoring
method for creativity assesment. Proposed by Forthmann,
)
Description: Implementation of Multidimensional Top Scoring
method for creativity assessment proposed by Forthmann,
Karwowski and Beaty (2023).
License: MIT + file LICENSE
Encoding: UTF-8
Expand All @@ -60,10 +60,10 @@ Imports:
purrr,
readr,
rlang (>= 0.4.11),
shiny,
stringr,
tibble
Suggests:
shiny,
covr,
datamods,
DT,
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# mtscr 1.0.0

* Initial CRAN submission.
6 changes: 5 additions & 1 deletion R/data.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Creativity assessment through semantic distance dataset
#'
#' A dataset from Forthmann, Karwowski & Beaty ([2023](https://doi.org/10.1037/aca0000571)) paper.
#' A dataset from Forthmann, Karwowski & Beaty (2023) paper.
#' It contains a set of responses in Alternative Uses Task for different items with their
#' semantic distance assessment.
#'
Expand All @@ -15,6 +15,7 @@
#' }
#'
#' @source <https://osf.io/7rgsp/>
#' @references \doi{10.1037/aca0000571}
"mtscr_creativity"

#' @rdname mtscr_self_rank
Expand All @@ -31,4 +32,7 @@
#' \item{avr}{average judges' raiting}
#' \item{top_two}{indicator of self-chosen two best answer; 1 if chosen, 0 if not}
#' }
#'
#' @source <https://osf.io/7rgsp/>
#' @references \doi{10.1037/aca0000571}
"mtscr_self_rank"
20 changes: 5 additions & 15 deletions R/mtscr_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#'
#' @return Runs the app. No explicit return value.
#'
#' @param debug_mode Integer. If 0, app runs normally. If 1, `needed_packages` are
#' returned. If 2, an invalid package is added to `needed_packages` and an error
#' is thrown.
#' @export
#'
#' @details
Expand Down Expand Up @@ -38,18 +35,14 @@
#' Forthmann, B., Karwowski, M., & Beaty, R. E. (2023).
#' Don’t throw the “bad” ideas away!
#' Multidimensional top scoring increases reliability of divergent thinking tasks.
#' Psychology of Aesthetics, Creativity, and the Arts. [https://doi.org/10.1037/aca0000571](https://doi.org/10.1037/aca0000571)
#' Psychology of Aesthetics, Creativity, and the Arts. \doi{10.1037/aca0000571}
#'
#' @examples
#' \dontrun{
#' mtscr_app()
#' }
mtscr_app <- function(debug_mode = 0) {
needed_packages <- if (debug_mode == 2) {
c("DT", "datamods", "writexl", "shinyWidgets", "INVALID_PACKAGE")
} else {
c("DT", "datamods", "writexl", "shinyWidgets")
}
mtscr_app <- function() {
needed_packages <- c("shiny", "DT", "datamods", "writexl", "shinyWidgets")

needed_packages <- sapply(needed_packages, \(x) {
if (system.file(package = x) != "") {
Expand Down Expand Up @@ -79,9 +72,6 @@ mtscr_app <- function(debug_mode = 0) {
)
)
}
if (debug_mode %in% 1:2) {
return(needed_packages)
} else {
shiny::runApp(app_dir, display.mode = "normal")
}

shiny::runApp(app_dir, display.mode = "normal")
}
5 changes: 4 additions & 1 deletion R/mtscr_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#' @examples
#' data("mtscr_creativity", package = "mtscr")
#'
#' mtscr_creativity <- mtscr_creativity |>
#' dplyr::slice_sample(n = 300) # for performance, ignore
#'
#' mtscr_model(mtscr_creativity, id, item, SemDis_MEAN) |>
#' summary()
#'
Expand All @@ -29,7 +32,7 @@
#' mtscr_model(data, id, item, SemDis_MEAN, prepared = TRUE)
#'
#' # extract effects for creativity score by hand
#' model <- mtscr_model(mtscr_creativity, id, item, SemDis_MEAN, top = 2)
#' model <- mtscr_model(mtscr_creativity, id, item, SemDis_MEAN, top = 1)
#' creativity_score <- glmmTMB::ranef(model)$cond$id[, 1]
mtscr_model <- function(df, id_column, item_column = NULL, score_column, top = 1, prepared = FALSE, ties_method = c("random", "average"), normalise = TRUE, self_ranking = NULL) {
id_column <- rlang::ensym(id_column)
Expand Down
16 changes: 10 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,35 @@ knitr::opts_chunk$set(
)
```

# Multidimensional Top Scoring for Creativity Research <img src="./man/figures/mtscr-hex.svg" width="200" align="right"/> {#multidimentional-top-scoring-for-creativity-research}
# Multidimensional Top Scoring for Creativity Research <img src="./man/figures/mtscr-hex.svg" width="200" align="right"/> {#multidimensional-top-scoring-for-creativity-research}

<!-- badges: start -->

[![codecov](https://codecov.io/gh/jakub-jedrusiak/mtscr/branch/main/graph/badge.svg?token=N3UGHFK5QN)](https://codecov.io/gh/jakub-jedrusiak/mtscr) [![R-CMD-check](https://github.com/jakub-jedrusiak/mtscr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jakub-jedrusiak/mtscr/actions/workflows/R-CMD-check.yaml)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![codecov](https://codecov.io/gh/jakub-jedrusiak/mtscr/branch/main/graph/badge.svg?token=N3UGHFK5QN)](https://app.codecov.io/gh/jakub-jedrusiak/mtscr) [![R-CMD-check](https://github.com/jakub-jedrusiak/mtscr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jakub-jedrusiak/mtscr/actions/workflows/R-CMD-check.yaml)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN status](https://www.r-pkg.org/badges/version/mtscr)](https://CRAN.R-project.org/package=mtscr)
<!-- badges: end -->

An R adaptation of Multidimensional Top Scoring method presented by Forthmann, Karwowski and Beaty ([2023](https://doi.org/10.1037/aca0000571)) using the code from the [OSF database](https://osf.io/7rgsp/). The code was adapted to use the [tidyverse](https://www.tidyverse.org/) framework for greater flexibility.

## Installation {#installation}

Install mtscr with:

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

You can install the development version of mtscr from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("jakub-jedrusiak/mtscr")
```

The mtscr package is not on CRAN yet.

## Usage {#usage}

Basic usage involves scoring participants' responses to a divergent thinking task. The package includes a sample dataset `mtscr_creativity` with 4652 responses to the [Alternative Uses Task](https://en.wikipedia.org/wiki/Alternative_uses_test) with semantic distance scored. The dataset comes from the original paper (Forthmann, Karwowski and Beaty, [2023](https://doi.org/10.1037/aca0000571)).
Basic usage involves scoring participants' responses to a divergent thinking task. The package includes a sample dataset `mtscr_creativity` with 4652 responses to the [Alternative Uses Task](https://en.wikipedia.org/wiki/Guilford%27s_Alternate_Uses) with semantic distance scored. The dataset comes from the original paper (Forthmann, Karwowski and Beaty, [2023](https://doi.org/10.1037/aca0000571)).

The main function is `mtscr_scores()` which returns a dataframe with scored responses. It takes a dataframe with responses, an ID column, an item column and a score column as arguments. The score column should contain semantic distance scores for each response. The function adds columns with scores for each person. The number of creativity scores is based on a given number of top answers provided by the `top` argument.

Expand Down
39 changes: 22 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

<!-- badges: start -->

[![codecov](https://codecov.io/gh/jakub-jedrusiak/mtscr/branch/main/graph/badge.svg?token=N3UGHFK5QN)](https://codecov.io/gh/jakub-jedrusiak/mtscr)
[![codecov](https://codecov.io/gh/jakub-jedrusiak/mtscr/branch/main/graph/badge.svg?token=N3UGHFK5QN)](https://app.codecov.io/gh/jakub-jedrusiak/mtscr)
[![R-CMD-check](https://github.com/jakub-jedrusiak/mtscr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jakub-jedrusiak/mtscr/actions/workflows/R-CMD-check.yaml)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN
status](https://www.r-pkg.org/badges/version/mtscr)](https://CRAN.R-project.org/package=mtscr)
<!-- badges: end -->
Expand All @@ -22,6 +22,12 @@ flexibility.

## Installation

Install mtscr with:

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

You can install the development version of mtscr from
[GitHub](https://github.com/) with:

Expand All @@ -30,16 +36,15 @@ You can install the development version of mtscr from
devtools::install_github("jakub-jedrusiak/mtscr")
```

The mtscr package is not on CRAN yet.

## Usage

Basic usage involves scoring participants’ responses to a divergent
thinking task. The package includes a sample dataset `mtscr_creativity`
with 4652 responses to the [Alternative Uses
Task](https://en.wikipedia.org/wiki/Alternative_uses_test) with semantic
distance scored. The dataset comes from the original paper (Forthmann,
Karwowski and Beaty, [2023](https://doi.org/10.1037/aca0000571)).
Task](https://en.wikipedia.org/wiki/Guilford%27s_Alternate_Uses) with
semantic distance scored. The dataset comes from the original paper
(Forthmann, Karwowski and Beaty,
[2023](https://doi.org/10.1037/aca0000571)).

The main function is `mtscr_scores()` which returns a dataframe with
scored responses. It takes a dataframe with responses, an ID column, an
Expand All @@ -56,14 +61,14 @@ mtscr_score(mtscr_creativity, id, item, SemDis_MEAN, top = 1:2)
#> # A tibble: 149 × 3
#> id .creativity_score_top1 .creativity_score_top2
#> <chr> <dbl> <dbl>
#> 1 84176 0.142 0.0696
#> 2 84177 -0.509 -0.494
#> 3 84178 -0.0737 -0.0990
#> 4 84188 0.530 0.527
#> 1 84176 0.142 0.0681
#> 2 84177 -0.508 -0.494
#> 3 84178 -0.0733 -0.0995
#> 4 84188 0.529 0.527
#> 5 84193 -0.299 -0.350
#> 6 84206 -0.310 -0.301
#> 7 84211 -0.0462 0.0360
#> 8 84226 0.239 0.211
#> 6 84206 -0.312 -0.301
#> 7 84211 -0.0464 0.0356
#> 8 84226 0.238 0.210
#> 9 84228 0.137 0.139
#> 10 84236 0.459 0.422
#> # ℹ 139 more rows
Expand All @@ -83,9 +88,9 @@ mtscr_model(mtscr_creativity, id, item, SemDis_MEAN, top = 1:3) |>
#> # A tibble: 3 × 9
#> model nobs sigma logLik AIC BIC df.residual emp_rel FDI
#> <chr> <int> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl>
#> 1 top1 4621 0.735 -5335. 10730. 10923. 4591 0.845 0.919
#> 2 top2 4621 0.767 -5511. 11082. 11275. 4591 0.869 0.932
#> 3 top3 4621 0.825 -5823. 11705. 11898. 4591 0.877 0.936
#> 1 top1 4585 0.736 -5298. 10657. 10850. 4555 0.877 0.936
#> 2 top2 4585 0.767 -5472. 11003. 11196. 4555 0.892 0.944
#> 3 top3 4585 0.825 -5777. 11613. 11806. 4555 0.896 0.947
```

### Graphical User Interface
Expand Down
5 changes: 5 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## R CMD check results

0 errors | 0 warnings | 1 note

* This is a new release.
11 changes: 5 additions & 6 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
citHeader("To cite mtscr in publications use:")

citEntry(
entry = "Manual",
bibentry(
mheader = "To cite mtscr in publications use:",
bibtype = "Manual",
title = "Multidimensional Top Scoring for Creativity Research",
author = "Boris Forthmann, Maciej Karwowski, Roger E. Beaty, Jakub Jędrusiak",
author = "Jakub Jędrusiak, Boris Forthmann, Roger E. Beaty, Maciej Karwowski",
year = "2023",
url = "https://github.com/jakub-jedrusiak/mtscr",
textVersion = paste(
"Forthmann, B., Karwowski, M., Beaty, R. E., Jędrusiak, J. (2023). Multidimensional Top Scoring for Creativity Research. Retrieved from: https://github.com/jakub-jedrusiak/mtscr"
"Jędrusiak, J., Forthmann, B., Beaty, R. E., Karwowski, M. (2023). Multidimensional Top Scoring for Creativity Research. Retrieved from: https://github.com/jakub-jedrusiak/mtscr"
)
)
6 changes: 3 additions & 3 deletions inst/GUI/rsconnect/shinyapps.io/jakub-jedrusiak/mtscr_GUI.dcf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ account: jakub-jedrusiak
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 9014241
bundleId: 7325206
bundleId: 7383306
url: https://jakub-jedrusiak.shinyapps.io/mtscr_GUI/
when: 1686322197.11898
lastSyncTime: 1686322197.119
when: 1687616453.90466
lastSyncTime: 1687616453.90468
asMultiple: FALSE
asStatic: FALSE
10 changes: 5 additions & 5 deletions man/mtscr-package.Rd

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

9 changes: 2 additions & 7 deletions man/mtscr_app.Rd

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

5 changes: 4 additions & 1 deletion man/mtscr_creativity.Rd

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

Loading

0 comments on commit 9496aae

Please sign in to comment.