Page 1 of 1

Linebreak in table note

Posted: Thu Apr 18, 2024 8:49 am
by DStuder
Hey folks

For the module I'm developing I added a note to the table using

Code: Select all

note <- paste("a) some text \n 
                      b) some more text \n 
                      c) even more text")
table$setNote(note)

The note contains a few different paragraphs, which I'd like to separate with a linebreak for visual clarity. So the output should look something like this:
Note. a) some text
b) some more text
c) even more text
Instead, I get:
Note. a) some text b) some more text c) even more text
Then I tried "<br>" instead of "\n", which does work for jamovi, but not for R:
a) some text <br> b) some more text <br> c) even more text
So, is there a way to achive a linebreak für table-notes in R?
I know I could probably use $addFootnote instead, but I'd prefer to get $setNote working, if at all possible.

Thanks in advance

Dan

Re: Linebreak in table note

Posted: Thu Apr 18, 2024 9:01 am
by jonathon
hi,

i'd set these as three separate notes:

table$setNote('a', 'some text')
table$setNote('b', 'some more text')
table$setNote('c', 'even some text')

cheers

Re: Linebreak in table note

Posted: Thu Apr 18, 2024 9:28 am
by DStuder
Hi jonathon

Thanks for the quick reply.
Adding them as separate notes works as such, but also repeats the "Note.", so the output then is

Code: Select all

Note. a) text
Note. b) some more text
Note. c) even more text
I was wondering if I could somehow create a different output based on whether the code is ran in the jamovi epplication or in RStudio, so then I could use this approach in RStudio and the <br>-approach in jamovi. Is there a way?

Best,
Dan

Re: Linebreak in table note

Posted: Thu Apr 18, 2024 9:41 am
by jonathon
i'm not sure. off the top of my head, i can't think of a way of discriminating between whether you're running in R, or in jamovi ... but i have some vague recollection that there's a way it can be done.

i, personally, would just go

Note. text
Note. some more text
Note. even more text

as that's how other modules work.

jonathon

Re: Linebreak in table note

Posted: Thu Apr 18, 2024 10:05 am
by DStuder
Alright, thanks for your help and the suggestion!