pharmaverse/examples

Demographic table example error message

Closed this issue · 2 comments

@pawelru using the latest CRAN installations of all packages in our posit cloud workspace I get the following when running the R code from https://github.com/pharmaverse/examples/blob/main/tlg/demographic.qmd:

> result <- build_table(lyt, adsl)
Error: Error applying analysis function (var - SEX): Assertion on 'x' failed: Must have at least 1 levels.
	occured at (row) path: root

Please can you update the example as needed.

I checked the code and it all should be good.
I went ahead to Posit Cloud and noticed that you might be using outdated version. Did git pull and that's the outcome:

/cloud/project$ git pull
remote: Enumerating objects: 599, done.
remote: Counting objects: 100% (353/353), done.
remote: Compressing objects: 100% (116/116), done.
remote: Total 599 (delta 279), reused 294 (delta 231), pack-reused 246
Receiving objects: 100% (599/599), 496.18 KiB | 26.11 MiB/s, done.
Resolving deltas: 100% (406/406), completed with 26 local objects.
From https://github.com/pharmaverse/examples
   0b1f7c7..483a3da  main       -> origin/main
   abcbf59..eda927d  gh-pages   -> origin/gh-pages
 * [new branch]      teal       -> origin/teal
Updating 0b1f7c7..483a3da
error: Your local changes to the following files would be overwritten by merge:
        tlg/demographic.qmd
Please commit your changes or stash them before you merge.
Aborting
/cloud/project$ git reset --hard
HEAD is now at 0b1f7c7 Merge pull request #60 from pharmaverse/enhance_gha
/cloud/project$ git pull
Updating 0b1f7c7..483a3da
Fast-forward
 DESCRIPTION                     |   4 +-
 README.md                       | 138 +++++----
 _quarto.yml                     |   2 +
 adam/adpc.R                     | 465 ++++++++++++++++++++++++++++
 adam/adpc.qmd                   |  25 +-
 adam/adppk.R                    | 435 ++++++++++++++++++++++++++
 adam/adppk.qmd                  |  21 +-
 adam/adsl.R                     | 142 +++++++++
 adam/adsl.qmd                   |  41 +--
 index.qmd                       |   7 +-
 logging/index.qmd               |   3 +
 logging/logging.qmd             | 915 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 logging/script.R                |  14 +
 {adam => metadata}/pk_spec.xlsx | Bin
 tlg/adverse_events.R            |  60 ++++
 tlg/adverse_events.qmd          |   6 +
 tlg/demographic.R               |  49 +++
 tlg/demographic.qmd             |   6 +
 18 files changed, 2239 insertions(+), 94 deletions(-)
 create mode 100644 adam/adpc.R
 create mode 100644 adam/adppk.R
 create mode 100644 adam/adsl.R
 create mode 100644 logging/index.qmd
 create mode 100644 logging/logging.qmd
 create mode 100644 logging/script.R
 rename {adam => metadata}/pk_spec.xlsx (100%)
 create mode 100644 tlg/adverse_events.R
 create mode 100644 tlg/demographic.R
/cloud/project$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

After this I was able to render the article:

/cloud/project$ quarto render tlg/demographic.qmd 


processing file: demographic.qmd
                                                                                                         
output file: demographic.knit.md

pandoc 
  to: html
  output-file: demographic.html
  standalone: true
  title-prefix: pharmaverse examples
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  css:
    - ../assets/css/style.scss
  number-sections: false
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en-US
  search: true
  theme:
    light:
      - flatly
    dark:
      - darkly
  anchor-sections: true
  smooth-scroll: true
  code-copy: true
  code-block-bg: true
  code-block-border-left: '#1482FA'
  page-layout: full
  title: Demographic Table
  order: 1
  
Warning message:
The downlit and xml2 packages are required for code linking 
Output created: ../_site/tlg/demographic.html

Now I'm just not so sure if git pull executed on my account also refreshes the "golden" environment that all the others are probably based on. My best guess is that it is not. I did refresh the page and the problem appeared again. Do you know how to "globally" and persistently run git pull?

ah of course, my mistake! i just repeated it on my side (think it has to be me as its my workspace) and all fine now, thanks!