Message-ID: <49706A4F.2090403@statistik.tu-dortmund.de>
Date: 2009-01-16T11:06:55Z
From: Uwe Ligges
Subject: function return output
In-Reply-To: <21496413.post@talk.nabble.com>
threshold wrote:
> Hi, I wrote the function which outputs a matrix 'c' and a single value 'd',
> as follows (simplified example):
> procedure <- function(a,b){
> ...
> list(c,d)
> }
> now I want to use 'c' and 'd' in code as follows:
> d <- matrix(0,1,1)
> value <- procedure(a,b)
> and d[1,1] <- value[2] breaks telling that:
> Error in d[1, 1] : incorrect number of dimensions
> What I did wrong??, best, robert
Probably "value" is a list, hence value[2] is also a list and you cannot
assign a list to an element of a *numeric* matrix. I guess you want
value[[2]].
Anyway, it is all a guess since we do not know what your "procedure()"
returns ....
Uwe Ligges
>
>
>