I will give it a try, thanks for your input!
Peter McMahan wrote:
>
>
> On Jan 10, 2008, at 9:48 PM, Peter McMahan wrote:
>
>> y <- matrix(rep(y,ncol(x)),nrow=nrow(y))
>> x[is.na(x)] <- y[is.na(x)]
>
> oops, i meant:
> y <- matrix(rep(y,ncol(res)),nrow=nrow(y))
> res[is.na(res)] <- y[is.na(r
On Jan 10, 2008, at 9:48 PM, Peter McMahan wrote:
> y <- matrix(rep(y,ncol(x)),nrow=nrow(y))
> x[is.na(x)] <- y[is.na(x)]
oops, i meant:
y <- matrix(rep(y,ncol(res)),nrow=nrow(y))
res[is.na(res)] <- y[is.na(res)]
__
R-help@r-project.org mailing list
h
try:
res <- apply(res,2,function(x){x[is.na(x)] <- y[is.na(x)];x})
should work, though not the most efficient/elegant
alternately:
y <- matrix(rep(y,ncol(x)),nrow=nrow(y))
x[is.na(x)] <- y[is.na(x)]
(also not the most efficient/elegant)
On Jan 10, 2008, at 9:38 PM, dxc13 wrote:
>
> useR's,
>
>
useR's,
Does anyone know of an efficient way to change the values in a list to
different numbers stored in an object? For example, consider the following:
y <- matrix(c(20, 13, 25, 10, 17), ncol = 1)
> res
[[1]]
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[,13] [
4 matches
Mail list logo