insightsengineering / formatters

A framework for creating listings of raw data that include specialized formatting, headers, footers, referential footnotes, and pagination.
https://insightsengineering.github.io/formatters/
Other
15 stars 6 forks source link

Fix var labels when named #263

Closed Melkiades closed 5 months ago

Melkiades commented 5 months ago

Fixes #262

library(formatters)
    labels <- letters[1:5]
    var_labels(iris) <- labels

    old_iris <- iris
    var_labels(iris) <- var_labels(iris)
    testthat::expect_identical(old_iris, iris)
    var_labels(iris)
#> Sepal.Length  Sepal.Width Petal.Length  Petal.Width      Species 
#>          "a"          "b"          "c"          "d"          "e"

    # teal.data
    labels <- letters[1:5]
    var_labels(iris) <- labels

    old_iris <- iris
    teal.data::col_labels(iris) <- teal.data::col_labels(iris)
    testthat::expect_identical(old_iris, iris)
    teal.data::col_labels(iris)
#> Sepal.Length  Sepal.Width Petal.Length  Petal.Width      Species 
#>          "a"          "b"          "c"          "d"          "e"

Created on 2024-02-27 with reprex v2.1.0

github-actions[bot] commented 5 months ago

badge

Code Coverage Summary

Filename             Stmts    Miss  Cover    Missing
-----------------  -------  ------  -------  -------------------------------------------------------------------------------------------------------------------------------------------
R/format_value.R       194      12  93.81%   88, 104-111, 189, 301, 401, 412, 420
R/generics.R           105       7  93.33%   454, 466, 499, 528, 652-658
R/labels.R              55       7  87.27%   49, 55, 64, 105, 133, 142, 146
R/matrix_form.R        552      50  90.94%   103, 455-456, 544, 557-560, 579, 611, 705-706, 721-726, 756-759, 792-793, 825-826, 870, 1033, 1057-1079, 1121, 1172, 1175, 1179
R/mpf_exporters.R      238      19  92.02%   2, 90-92, 201, 241, 246, 429, 432, 438-441, 479, 551-554, 567
R/page_size.R           45       1  97.78%   172
R/pagination.R         634      49  92.27%   250, 302-305, 407-420, 582, 765-766, 787-797, 1000-1016, 1148, 1155, 1362-1363, 1375-1376, 1390-1391
R/tostring.R           586      49  91.64%   41, 93, 162, 196, 204, 240, 297-300, 393-397, 400-403, 410-415, 492, 631-632, 697-704, 761-765, 849, 864, 958, 1010, 1051, 1096, 1151, 1158
R/utils.R                3       0  100.00%
R/zzz.R                 17       6  64.71%   29-34
TOTAL                 2429     200  91.77%

Diff against main

Filename      Stmts    Miss  Cover
----------  -------  ------  --------
TOTAL             0       0  +100.00%

Results for commit: 557444844f99a80f3f7918abdffc8594b520919e

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results

github-actions[bot] commented 5 months ago

Unit Tests Summary

  1 files    5 suites   9s :stopwatch:  43 tests  43 :white_check_mark: 0 :zzz: 0 :x: 295 runs  295 :white_check_mark: 0 :zzz: 0 :x:

Results for commit 55744484.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 5 months ago

Unit Test Performance Difference

Additional test case details | Test Suite | $Status$ | Time on `main` | $±Time$ | Test Case | |:-----|:----:|:----:|:----:|:-----| | formatters | 👶 | | $+0.00$ | var_labels_works_in_self_assignment_with_named_values |

Results for commit bfd04ebf03fd0ad8cb9e208a2291a8e3e5dc9857

♻️ This comment has been updated with latest results.

Melkiades commented 5 months ago

@pawelru @shajoezhu this is ready