pharmaverse / pharmaverse/formatters

`nlines` function fails when width is narrower than the string

Open
#299 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
R
Stars
20
Forks
8
Avg merge
12h 28m
Merged PRs (30d)
1

Description

Summary

There's a problem with nlines function initially described here: https://github.com/insightsengineering/rtables/pull/875#issuecomment-2154907466

formatters::nlines("01234567890", max_width = 5)
#> Error in FUN(X[[i]], ...): argument "fontspec" is missing, with no default

Created on 2024-06-10 with reprex v2.1.0

R session info


# R -e "utils::sessionInfo()" output goes here
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_IE.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_IE.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_IE.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_IE.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Berlin
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.4.0        BiocManager_1.30.23   backports_1.5.0       fastmap_1.2.0        
 [5] cli_3.6.2             htmltools_0.5.8.1     tools_4.4.0           rstudioapi_0.16.0    
 [9] grid_4.4.0            checkmate_2.3.1       formatters_0.5.7.9001 digest_0.6.35        
[13] lifecycle_1.0.4       rlang_1.1.4           renv_1.0.2           

OS / Environment

  • OS: Ubuntu 24.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the formatters::nlines entry point and run the supplied example with max_width = 5 to reproduce the missing fontspec error. Trace the narrow-width path and add a regression test if the repository's test location is identified. Done means nlines handles a width narrower than the input string without error; the expected returned value still needs clarification.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.