Native language issue


I have a tibble with dates in wide format. I transposed this tibble so that I have a column of dates as a variable and a column of values with melt function (reshape package) as well as with pivot_longer function (tidyr package). In both cases the character values which were written in my native language (Armenian) messed up and now there are weird symbols in their place.

How do you come to have the tibble in question?
You constructed it by typing it into your code? If so confirm that the script encoding is UTF-8.
If you imported from a file such as a CSV. Confirm that the CSV is in UTF-8

I have read it from an excel file. okay and how can I confirm script encoding or check it?

what R command did you use ?

R command? R studio? Do you mean that?

What code did you write

Ah yes, sorry. here is my code.





df_db <- read_excel("Working_X.xlsx", sheet = "Accounts_DB")
col <- colnames(df_db[,1:18])

m_db <- iconv(df_db,from = "Latin-1", to = "UTF-8")

m_db <- melt(df_db, col, na.rm = TRUE, = "Value" )

And by the way the code written as
iconv(df_db,from = "Latin-1", to = "UTF-8") doesn't work.
It generates an error - unsupported conversion from Latin-1 to UTF-8

Here is the topic I have created on this issue.

iconv() wants to convert character vectors, it wont work for dataframes like you are trying to use it.

Were you trying iconv because you know your excel file is in Latin-1 encoding ? or was that a guess on your part ?
If you have excel perhaps you can open the file and resave it with UTF-8 encoding ?

Perhaps you can raise an issue, or add to an existing issue on readxl github.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.