From p.dalgaard@biostat.ku.dk  Thu Feb  6 11:11:03 2003
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: Thu Feb  6 11:11:03 2003
Subject: [Rd] R/S indexing difference
In-Reply-To: <Pine.LNX.4.44.0302051943460.442-100000@gannet.stats>
References: <Pine.LNX.4.44.0302051943460.442-100000@gannet.stats>
Message-ID: <x2bs1pk9c4.fsf@biostat.ku.dk>

ripley@stats.ox.ac.uk writes:

> Is this intentional?
> 
> R:
> > x <- 1:7
> > x[c(1, NA, 3)] <- -(4:6)
> > x
> [1] -4  2 -6  4  5  6  7
> 
> so NAs are treated as FALSE
> 
> S+6.1:
> > x <- 1:7
> > x[c(1, NA, 3)] <- -(4:6)
> Warning messages:
>   Replacement length not a multiple of number of elements to
> 	replace in: x[c(1, NA, 3)] <-  - (4:6)
> > x
> [1] -4  2 -5  4  5  6  7
> 
> and NAs are ignored.

Hmm. Neither of the options look too safe to me...

A 3rd bit of logic would say that you should get a vector of
7 NAs since you're asking to put the -5 into an unknown location...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907



[Rd] R/S indexing difference
Peter Dalgaard BSA