[R] path.expand fails on some windows platform

Manuel Muñoz Márquez m@nue|@munoz@m@rquez @end|ng |rom gm@||@com
Wed Jul 8 17:32:07 CEST 2026


Dear all.

When using R version 4.6.1 on certain Windows platforms where the username contains non-ASCII characters (such as "á"), the command:
path.expand("~")
fails with the following error:
Error: file name conversion problem -- name too long?

This occurs when the Windows OS does not define the R_USER environment variable. In these cases, a call to Sys.getenv("R_USER") returns an
empty string ("").

However, if an .Renviron file is created with a valid path, such as:
R_USER="C:\Users\%Username%\Documents"
then path.expand() works properly no matter if which the %Username% is.

This error propagates to other functions that internally call path.expand(), such as file.exists().

This behavior has been confirmed on multiple computers by various users running Windows 10 and 11.

In my opinion, this is a bug, as a standard path expansion should not trigger a conversion error under these circumstances. Or is this the
expected behavior in this scenario?

More info:

https://github.com/RCmdr-Project/rcmdr/issues/8

Thank in advance.

-- 
Manuel Muñoz Márquez <manuel.munoz.marquez using gmail.com>



More information about the R-help mailing list