[R] How to set default encoding for sourced files
Andrew Hart
@h@rt @end|ng |rom d|m@uch||e@c|
Wed Sep 21 20:05:13 CEST 2022
On 21/09/2022 11:46, Bert Gunter wrote:
> ?options
>
> options(encoding = "utf-8")
> in a startup file or function should presumably do it. See ?Startup
>
> Bert
Thanks everyone. Setting encoding in options in Rprofile.site has taken
care of it.
Curiously, it doesn't seem to solve the whole problem for Rscript
though. I checked that Rscript is indeed picking up the default encoding
from options, but it's complaining about seeing an unexpected input in
dat$línea <- ....
immediately following the l when I run
Rscript myfile.R.
So, it would appear that Rscript is not using source to read in the R
script. Mind you, if I do
Rscript -e source('myfile.R')
it works properly just like in Rgui.
Once again, Thanks heaps.
Cheers,
Andrew.
More information about the R-help
mailing list