I want to export a table using write.csv
. There are 2 flavors of write.csv
changing the defaults for the field and the decimal separator.
write.csv
uses .
as the decimal point separator and ,
as the field separatorwrite.csv2
uses ,
as the decimal point separator and ;
as the field separatorI want, however, to use the local regional setting (which may be altered from the locale
by the user):
Thus, for this user I would like to use .
as a decimal separator and ;
as a field separator. How could I query these settings from R
?
You can query the corresponding registry entries following https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/reg-query
For example:
# get list separator
system('reg query "HKEY_CURRENT_USER\\Control Panel\\International" /v sList', intern = TRUE)
# get decimal symbol
system('reg query "HKEY_CURRENT_USER\\Control Panel\\International" /v sDecimal', intern = TRUE)
Sorry, I'm not familiar with Window's built-in command line cmd
& I can't find out how to only extract the value itself. However, this can easily be done in R...
Works on my Windows 10 virtual machine...