[R] How to add values to an array at any position.
ggrothendieck at myway.com
Sun Oct 31 00:42:11 CEST 2004
Witold Eryk Wolski <wolski <at> molgen.mpg.de> writes:
: How to add values to an array at any position.
: Asking because of the following:
: y<-c(0.1,NaN,0.2,NaN) #or data frame
: take some columns from x and
: do some computation with functions which do not allow NaN 's.
: After the computing add NaN's at positions stored in
: of the result vector.
The following adds one to each element of x and reinserts
them into y:
y[-attr(x,"na.action")] <- x+1
More information about the R-help