:r-help-boun...@r-project.org] On
> Behalf Of Petr Savicky
> Sent: Wednesday, April 27, 2011 11:01 AM
> To: r-help@r-project.org
> Subject: Re: [R] matrix of higher order differences
>
> On Wed, Apr 27, 2011 at 11:25:42AM +, Hans W Borchers wrote:
>> Jeroen Ooms gmail.com>
ject.org] On
> Behalf Of Petr Savicky
> Sent: Wednesday, April 27, 2011 11:01 AM
> To: r-help@r-project.org
> Subject: Re: [R] matrix of higher order differences
>
> On Wed, Apr 27, 2011 at 11:25:42AM +, Hans W Borchers wrote:
>> Jeroen Ooms gmail.com> writes:
>&
-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Petr Savicky
Sent: Wednesday, April 27, 2011 11:01 AM
To: r-help@r-project.org
Subject: Re: [R] matrix of higher order differences
On Wed, Apr 27, 2011 at 11:25:42AM +, Hans W Borchers wrote:
> Jeroen Ooms gmail.com> writes:
>
&g
On Wed, Apr 27, 2011 at 11:25:42AM +, Hans W Borchers wrote:
> Jeroen Ooms gmail.com> writes:
>
> >
> > Is there an easy way to turn a vector of length n into an n by n matrix, in
> > which the diagonal equals the vector, the first off diagonal equals the
> > first order differences, the sec
On Apr 27, 2011, at 7:25 AM, Hans W Borchers wrote:
Jeroen Ooms gmail.com> writes:
Is there an easy way to turn a vector of length n into an n by n
matrix, in
which the diagonal equals the vector, the first off diagonal equals
the
first order differences, the second... etc. I.e. to do
Jeroen Ooms gmail.com> writes:
>
> Is there an easy way to turn a vector of length n into an n by n matrix, in
> which the diagonal equals the vector, the first off diagonal equals the
> first order differences, the second... etc. I.e. to do this more
> efficiently:
>
> diffmatrix <- function(x
Is there an easy way to turn a vector of length n into an n by n matrix, in
which the diagonal equals the vector, the first off diagonal equals the
first order differences, the second... etc. I.e. to do this more
efficiently:
diffmatrix <- function(x){
n <- length(x);
M <- diag(x);
7 matches
Mail list logo