Skip to content
Prev 10629 / 63424 Next

Documentation of ``Extract'' re. drop argument (PR#4297)

Problem:

?Extract

does not clearly state that the `drop' argument can only be used in 
subscripting, but not in subassigning.

Example:

x <- t(1:10)
x
        [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
  [1,]     1    2    3    4    5    6    7    8    9    10

x[,1:5,drop=F] <- 10:14
Error: incorrect number of subscripts

but

x[,1:5] <- 10:14
x
       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
  [1,]   10   11   12   13   14    6    7    8    9    10

Proposed fix:

Adding a corresponding note in the doc. of the `drop' argument, or 
after the

  If one of these expressions appears on the left side of an
  assignment then that part of 'x' is set to the value of the right
  hand side of the assignment.

paragraph in the `details' section of the `Extract' help page.
_                platform i686-pc-linux-gnu
arch     i686             os       linux-gnu        system   i686, 
linux-gnu  status   alpha            major    1                minor    
8.0              year     2003             month    09               
day      24               language R