Hi Jessica and Jim,
Thanks for the feedback,
Jessica: currently I am defining the functions as the same, but they
will be altered at some point soon. Also, I figured that defining the
matrix elements as functions would give a dual possibility to the
matrix entry depending on the conditions (i.e. o
You need to learn how to debug your code. The most important thing to
do is to add:
options(error=utils::recover)
This will drop you into the 'browser' at the point of the error and
then you can examine each of the objects to see where the problem is.
As the error says, you have a non-numeric ar
: Tuesday, November 6, 2012 8:10 AM
Subject: Re: [R] Filling matrix elements with a function
Try this if you want a matrix of functions:
> # define matrix of list()
> x <- vector('list', 25)
> dim(x) <- c(5,5)
> f.1 <- function(x) x * x
> x[[1,1]] <- f.1
> x[[2,2]
Try this if you want a matrix of functions:
> # define matrix of list()
> x <- vector('list', 25)
> dim(x) <- c(5,5)
> f.1 <- function(x) x * x
> x[[1,1]] <- f.1
> x[[2,2]] <- f.1
> # call the functions
> x[[2,2]](42)
[1] 1764
> x[[1,1]](3)
[1] 9
>
On Tue, Nov 6, 2012 at 6:01 AM, Jessica Strei
Not that i really understand what that shall do, but..
why do you define 2 functions that do exactly the same?
why do you want to make a matrix of functions instead of a matrix with the
results of functions?
On 06.11.2012, at 05:11, Aimee Kopolow wrote:
> Hi all,
>
>
> I have a matrix simulat
Hi all,
I have a matrix simulating migration in a spatial model. I want to be
able to define movement (the values of m1, m2 and m3) as only != 0
between adjacent patches and contingent on certain conditions as
defined in the function.
Here is the code:
WET<-function(t) {everglades$precipitation
6 matches
Mail list logo