I entered a text string in .csv
file , which includes unicode symbols as: \U00B5
g/dL.
In .csv
file as well as read in R data frame:
test=read.csv("test.csv")
\U00B5
would produce the micro sign- µ. R read it into data file as it is (\U00B5
). However when I print the string it shows as \\U00B5 g/dL
.
Alternatively, manually entering the code works fine.
varname <- c("a", "b", "c")
labels <- c("A \U00B5 g/dL", "B \U00B5 g/dL", "C \U00B5 g/dL")
df <- data.frame(varname, labels)
test <- data.frame(varname, labels)
test
# varname labels
# 1 a A µ g/dL
# 2 b B µ g/dL
# 3 c C µ g/dL
I wonder how could I get rid of the escape sign \
in this case and have it print out the symbol.
Or, if there another way to print out the symbol in R.
Thank you very much for this help!