I am trying to make line breaks while printing. A.
here is my code:
temp <- LETTERS[1:11] print(sprintf("Rank %s = %s \n", 1:11, temp))
exit:
[1] "Rank 1 = A \n" "Rank 2 = B \n" "Rank 3 = C \n" "Rank 4 = D \n" "Rank 5 = E \n" "Rank 6 = F \n" "Rank 7 = G \n" "Rank 8 = H \n" "Rank 9 = I \n" [10] "Rank 10 = J \n" "Rank 11 = K \n"
I naively thought that \n made a line break. My desired result:
"Rank 1 = A" "Rank 2 = B" "Rank 3 = C" "Rank 4 = D" ... etc.
EDIT:
Pascal comment tells me that it works with cat
cat(sprintf("Rank %s = %s \n", 1:11, temp))
I use this code inside renderText inside brilliant. print will return text, but I cannot get cat to return text.
In this case, is there anywhere to generate the required line breaks without using cat ?
source share