R-beta: R and LANG

Goran Brostrom gb at stat.umu.se
Thu Jan 8 14:53:37 CET 1998


I am running R 0.61.0 on a Sparc 5, Solaris 2.4, in tcsh. Today I
couldn't, to my big surprise, scan a data file in R. As I finally
understood it, R wanted a decimal comma instead of a decimal point,
because LANG was set to 'sv'. See my runs below. I wonder why this 
happens now for the first time, I have had LANG set to sv for many
years. 'unsetenv LANG' made things turn back to normal again, so I 
guess that I have to remove a certain line from my .login file.

This is fair enough, but it seems as if no arithmetic whatsoever
can be done when LANG = sv. With decimal point calculations are wrong
(decimals in arguments get discarded), with decimal comma I get syntax
error.

Can someone tell me what is going on? If it is supposed to be a 
feature in R to recognize LANG, something seems to be wrong.

gb[124]$ setenv LANG sv
gb[125]$ R

R : Copyright 1997, Robert Gentleman and Ross Ihaka
Version 0.61.0 Alpha (December 21, 1997)
.............................
> scan("haz.dat")
Read 6 items
[1] 1,00000 1,00000 0,00460 1,00000 2,00000 0,00666
> scan("hazards.dat")
Error: "scan" expected a real got "1.0000"
> 0.2 + 0.3
[1] 0
> 0.2 + 0.9
[1] 0
> 1.9 + 1.9
[1] 2
> 0,2 + 0,9
Error: syntax error
> q()
Save workspace image? [y/n/c]: n
4.34u 0.59s 4:02.79 2.0%
gb[126]$ unsetenv LANG
gb[127]$ R

R : Copyright 1997, Robert Gentleman and Ross Ihaka
Version 0.61.0 Alpha (December 21, 1997)
.............................
> scan("haz.dat")
Error: "scan" expected a real got "0,0046"
> scan("hazards.dat")
[1]   1.000000   1.000000   0.004640   1.000000   2.000000   0.006660
> 0.2 + 0.3
[1] 0.5
> 0.2 + 0.9
[1] 1.1
> 0,2 + 0,9
Error: syntax error

Goran
---
Goran Brostrom                         phone : +46 90 7865223
Department of Statistics                              7865213 (secr)
Umea University                        fax   :        7866614
S-90187 Umea, Sweden                   e-mail: gb at stat.umu.se

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list