Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml Can't combine ..1$abb <character> and ..5$abb <logical>. #340

Open
KatherineKayMRG opened this issue Jun 17, 2024 · 2 comments
Open

Comments

@KatherineKayMRG
Copy link
Collaborator

I included the following in a glossary yaml

OBS:
  abb: OBS
  def: observations above the LLOQ
nEDA:
  abb: n
  def: number of subjects summarized
SD: 
  abb: SD
  def: standard deviation

when trying to run glo <- read_glossary(here("report/glossary.yaml")) I got an error

glo <- read_glossary(here("report/glossary.yaml"))
Error in `read_yaml_glossary()` at pmtables/R/glossary.R:75:5:
! Failed to parse glossary file; see ?yaml_as_df() for help formatting this file.
• Error in dplyr::bind_rows(res, .id = .id) : 
  Can't combine `..1$abb` <character> and `..5$abb` <logical>.
Run `rlang::last_trace()` to see where the error occurred.

It was fixed with

OBS:
  abb: OBS
  def: observations above the LLOQ
nEDA:
  abb: "n"
  def: number of subjects summarized
SD: 
  abb: SD
  def: standard deviation

Is this expected behaviour? Is there anything we can do? It's such an unhelpful error message

@kylebaron
Copy link
Contributor

It's expected, sort of. yaml sees a bare n and it interprets that as "no", turning abb into a logical value. When you write "n", you're telling the parser that you mean this to be a character value.

You'll see the same error if you call

df <- yaml_as_df(here("report/glossary.yaml"))

We could document this better, but don't know how helpful that would be in the wild. Maybe some other stuff we could do help when this happens, but I don't think there is any way to write bare n and not have yaml turn that into FALSE.

@KatherineKayMRG
Copy link
Collaborator Author

Ah ok, sorry I didn't make the connection between n > no > FALSE for yaml. I'm not sure where to suggest documenting it but I guess it might not be important often?

Thanks for following up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants