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

Giovanni Petris GPetris at uark.edu
Fri Oct 17 23:03:35 CEST 2003


See ?[[
"[[" operates recursively, so 
sw[[2,1]] is the same as sw[[2]][[1]] 

Giovanni

> Date: Fri, 17 Oct 2003 12:30:07 -0400
> From: "Backlund, Jan Erik (JE)" <jebacklund at dow.com>
> Sender: r-help-bounces at stat.math.ethz.ch
> Cc: 
> Precedence: list
> 
> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 
> 

-- 

 __________________________________________________
[                                                  ]
[ Giovanni Petris                 GPetris at uark.edu ]
[ Department of Mathematical Sciences              ]
[ University of Arkansas - Fayetteville, AR 72701  ]
[ Ph: (479) 575-6324, 575-8630 (fax)               ]
[ http://definetti.uark.edu/~gpetris/              ]
[__________________________________________________]




More information about the R-help mailing list