Closed cmaimone closed 2 years ago
@cmaimone Thanks for raising this.
weat
S3 object is not plottable. plot
is not an available S3 method (which is still a function) for this object and it is reflected by printing the object (cf. rnd
).
require(sweater)
#> Loading required package: sweater
S4 <- c("math", "algebra", "geometry", "calculus", "equations", "computation", "numbers", "addition")
T4 <- c("poetry", "art", "dance", "literature", "novel", "symphony", "drama", "sculpture")
A4 <- c("male", "man", "boy", "brother", "he", "him", "his", "son")
B4 <- c("female", "woman", "girl", "sister", "she", "her", "hers", "daughter")
sw <- query(glove_math, S4, T4, A4, B4)
sw
#>
#> ── sweater object ──────────────────────────────────────────────────────────────
#> Test type: weat
#> Effect size: 1.055015
#>
#> ── Functions ───────────────────────────────────────────────────────────────────
#> • <calculate_es()>: Calculate effect size
#> • <weat_resampling()>: Conduct statistical test
sw2 <- query(glove_math, S_words = S4, A_words = A4, B_words = B4)
sw2
#>
#> ── sweater object ──────────────────────────────────────────────────────────────
#> Test type: rnd
#> Effect size: -1.147534
#>
#> ── Functions ───────────────────────────────────────────────────────────────────
#> • <calculate_es()>: Calculate effect size
#> • <plot()>: Plot the bias of each individual word
Created on 2022-01-27 by the reprex package (v2.0.1)
But the error message can be better, e.g. object of type 'weat' is not plottable.
[^JOKE] I will amend the error message to something more useful.
[^JOKE]: OK, this is an in-joke. object of type 'closure' is not subsettable
@cmaimone I think this error message is more useful.
require(sweater)
#> Loading required package: sweater
S4 <- c("math", "algebra", "geometry", "calculus", "equations", "computation", "numbers", "addition")
T4 <- c("poetry", "art", "dance", "literature", "novel", "symphony", "drama", "sculpture")
A4 <- c("male", "man", "boy", "brother", "he", "him", "his", "son")
B4 <- c("female", "woman", "girl", "sister", "she", "her", "hers", "daughter")
sw <- query(glove_math, S4, T4, A4, B4)
sw
#>
#> ── sweater object ──────────────────────────────────────────────────────────────
#> Test type: weat
#> Effect size: 1.055015
#>
#> ── Functions ───────────────────────────────────────────────────────────────────
#> • <calculate_es()>: Calculate effect size
#> • <weat_resampling()>: Conduct statistical test
plot(sw)
#> Error: Plotting the result of this test type (weat) is not supported.
plot_bias(sw)
#> Error: Plotting the result of this test type (weat) is not supported.
Created on 2022-01-27 by the reprex package (v2.0.1)
Also it is now explicitly documented in the man page.
That helps
^ I ran the example, then tried to plot. Should this be giving this error?
re: https://github.com/openjournals/joss-reviews/issues/4036