Re: [R] How to apply a function on each column of a matrix

2010-01-23 Thread Ted Harding
On 24-Jan-10 00:27:37, Jim Lemon wrote: > On 01/24/2010 11:11 AM, anna wrote: >> >> Here is the last code that I wrote but it would give me the >> same problem: >> I have the matrix mat with n columns mat.1, mat.2 ...mat.n >> >> #To be able to use lapply I convert it to a data.frame: >> mat<- data

Re: [R] How to apply a function on each column of a matrix

2010-01-23 Thread Jim Lemon
On 01/24/2010 11:11 AM, anna wrote: Here is the last code that I wrote but it would give me the same problem: I have the matrix mat with n columns mat.1, mat.2 ...mat.n #To be able to use lapply I convert it to a data.frame: mat<- data.frame(mat) lapply(mat, function, argument of function) It

Re: [R] How to apply a function on each column of a matrix

2010-01-23 Thread anna
Here is the last code that I wrote but it would give me the same problem: I have the matrix mat with n columns mat.1, mat.2 ...mat.n #To be able to use lapply I convert it to a data.frame: mat <- data.frame(mat) lapply(mat, function, argument of function) It works but I still get for all eleme

[R] How to apply a function on each column of a matrix

2010-01-23 Thread anna
Hello everyone, I get for each date a measure for n elements in the form of a matrix. I am converting it to a ts object using ts(). I want to apply a function on each column. I started using the apply function ( set to 2) but what it returns is a matrix with the same columns representing the funct