Linebreak in table note

Everything related to the development of modules in jamovi
Post Reply
DStuder
Posts: 9
Joined: Wed Jun 07, 2023 8:07 am

Linebreak in table note

Post 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
User avatar
jonathon
Posts: 2651
Joined: Fri Jan 27, 2017 10:04 am

Re: Linebreak in table note

Post 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
DStuder
Posts: 9
Joined: Wed Jun 07, 2023 8:07 am

Re: Linebreak in table note

Post 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
User avatar
jonathon
Posts: 2651
Joined: Fri Jan 27, 2017 10:04 am

Re: Linebreak in table note

Post 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
DStuder
Posts: 9
Joined: Wed Jun 07, 2023 8:07 am

Re: Linebreak in table note

Post by DStuder »

Alright, thanks for your help and the suggestion!
Post Reply