There is a function example to wrap text Ref: Text wrap for plot titles But how can I get the text to be both left and right hand side justified? (justified—text is aligned along the left margin, and letter- and word-spacing is adjusted so that the text falls flush with both margins, also known as fully justified or full justification).
plot(rnorm(100), main = paste(
strwrap(
'This is a very long title wrapped on multiple lines without the need to adjust it by hand',
whitespace_only = TRUE,
width = 50
),
collapse = "\n"
))