Re: [R] Problem with new version of R: Mutated vocals

2024-03-22 Thread Ivan Krylov via R-help
В Fri, 22 Mar 2024 16:11:14 +
MACHO Siegfried via R-help  пишет:

> If I type the command:
> Dir <- "C/Users/macho/Documents/_LVn/Experimentelle _bungen"
> in the R console there is no problem. However, if I put the same
> command into a source file (e.g. Test.r) and call this file from R
> (via the source command), I get the following error message:
> 
> > source("C:\\Users\\macho\\Documents\\_LVn\\Experimentelle
> > _bungen\\R-Scripts\\R-Dokumentation\\R_scripts zur
> > R_Dokumentation\\Kapitel 4 Erstellen eines
> > Balkendiagramms\\Test.R")  
> Fehler: invalid multibyte character in parser
> (C:\Users\macho\Documents\_LVn\Experimentelle
> _bungen\R-Scripts\R-Dokumentation\R_scripts zur
> R_Dokumentation\Kapitel 4 Erstellen eines Balkendiagramms\Test.R:1:54

A few versions ago, the R developers made the change of the encoding
used by R on Windows. Instead of the ANSI encoding, R now uses UTF-8:
https://blog.r-project.org/2020/05/02/utf-8-support-on-windows/index.html

This makes it possible to represent many more characters than the
256-byte range covered by CP1252, but the byte sequences are now
different. Also, non-ASCII characters will take more than one byte to
store.

Can you save the script using the UTF-8 encoding instead of CP1252?
Alternatively, try source(..., encoding = 'CP1252').

> In addition, text files saved with an older version of R (using the
> function write.table) containing mutated vowels are not read-in
> correctly by the function read.table.

In a similar manner, try read.table(..., fileEncoding = 'CP1252').
Setting encoding = 'latin1' may also work, even if it's technically a
different encoding.

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with new version of R: Mutated vocals

2024-03-22 Thread MACHO Siegfried via R-help
Dear ladies and gentlemen,

I have recently installed the latest version of R (4.3.3) for windows. Now I 
have the following problems with mutated vowels like �, �, etc. Here is an 
example:
If I type the command:
Dir <- "C/Users/macho/Documents/_LVn/Experimentelle �bungen"
in the R console there is no problem. However, if I put the same command into a 
source file (e.g. Test.r) and call this file from R (via the source command), I 
get the following error message:

> source("C:\\Users\\macho\\Documents\\_LVn\\Experimentelle 
> �bungen\\R-Scripts\\R-Dokumentation\\R_scripts zur R_Dokumentation\\Kapitel 4 
> Erstellen eines Balkendiagramms\\Test.R")
Fehler: invalid multibyte character in parser 
(C:\Users\macho\Documents\_LVn\Experimentelle 
�bungen\R-Scripts\R-Dokumentation\R_scripts zur R_Dokumentation\Kapitel 4 
Erstellen eines Balkendiagramms\Test.R:1:54

In addition, text files saved with an older version of R (using the function 
write.table) containing mutated vowels are not read-in correctly by the 
function read.table.
I would be glad, if someone could help me with this problem.

Kind regards,
Siegfried Macho.

--
PD Dr. Siegfried Macho
Psychological Department
University of Fribourg
Rue de Faucigny 2
CH-1700 Fribourg
Tel.: ++41-26-3007635
-




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.