[R] Behavior of [[ in S vs. R

Backlund, Jan Erik (JE) jebacklund at dow.com
Fri Oct 17 18:30:07 CEST 2003


I am confused by the following difference in the behavior of R and S. Any
clarification would be greatly appreciated.
Jan Erik Backlund
Dow AgroSciences, LLC.
jebacklund at dow.com


R : Copyright 2003, The R Development Core Team
Version 1.8.0  (2003-10-08)
> sw
             Fertility Agriculture Examination Education Catholic
Courtelary        80.2        17.0          15        12     9.96
Delemont          83.1        45.1           6         9    84.84
Franches-Mnt      92.5        39.7           5         5    93.40
Moutier           85.8        36.5          12         7    33.77
Neuveville        76.9        43.5          17        15     5.16
> sw[2,1]
[1] 83.1
> sw[[2,1]]
[1] 17
> 

and the corresponding behaviour in S
S-PLUS : Copyright (c) 1988, 2001 Insightful Corp.
S : Copyright Lucent Technologies, Inc.
Professional Edition Version 6.0.3 Release 2 for Microsoft Windows : 2001 
> sw
             Fertility Agriculture Examination Education Catholic 
  Courtelary      80.2        17.0          15        12     9.96
    Delemont      83.1        45.1           6         9    84.84
Franches-Mnt      92.5        39.7           5         5    93.40
     Moutier      85.8        36.5          12         7    33.77
  Neuveville      76.9        43.5          17        15     5.16
> sw[2,1]
[1] 83.1
> sw[[2,1]]
[1] 83.1




More information about the R-help mailing list