Reputation: 99
I have a dataframe that is incorporated in the DT table. But the sentences are long. So can we break the sentences and put in the second line
This is the dataframe with 2 rows
df
COlA
Sentence is too long to be written here
Sentence is too long to be written here
Expected output
df
COlA
Sentence is too long
-to be written here
Sentence is too long
-to be written here
Upvotes: 0
Views: 64
Reputation: 5003
To keep all automatically set the same widths for the whole column you can use
stringr::str_wrap("Sentence is too long to be written here", width = 20)
To make the changes visible in you shiny application you would the also need to add the following lines somewhere in you ui code
tags$style(
"td{white-space:pre;"
)
Upvotes: 4