Skip to content

Commit b9ab1e4

Browse files
committed
Translate \n to <br /> in fct labels, too
Before, this only worked for colums of type character.
1 parent 65493ad commit b9ab1e4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

R/utils.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,14 @@ translate_linebreaks <- function(p) {
609609
typ <- typeof(a)
610610
if (typ == "list") {
611611
# retain the class of list elements
612-
# which important for many things, such as colorbars
612+
# which is important for many things, such as colorbars
613613
a[] <- lapply(a, recurse)
614614
} else if (typ == "character" && !inherits(a, "JS_EVAL")) {
615615
attrs <- attributes(a)
616616
a <- gsub("\n", br(), a, fixed = TRUE)
617617
attributes(a) <- attrs
618+
} else if (is.factor(a)) {
619+
levels(a) <- gsub("\n", br(), levels(a), fixed = TRUE)
618620
}
619621
a
620622
}

0 commit comments

Comments
 (0)