Skip to content
Back to formatted view

Raw Message

Message-ID: <49B40C58.4040702@statistik.tu-dortmund.de>
Date: 2009-03-08T18:20:08Z
From: Uwe Ligges
Subject: Question on Variabeles
In-Reply-To: <22388117.post@talk.nabble.com>

David1234 wrote:
> Hi everyone,
> 
> Im quite new to R an I have the following Question:
> 
> 
> I would like to define Variables which I can add and multiply etc. and that
> R can simplyfy the terms.
> 
> The variables should stand for integers. 
> For example I would like to have an entry in an array with variable   z   
> and if I  add    b+z    the field should now contain 2z+b.  Or if the field
> contains   1    and I add    z    the field should contain 1+z.
> 
> How can I solve this problem?
> 
> I tried to set z=integer and then for example matrix[1,1]=i
> But this does only work if I assign a value for z first.
> 
> I am very grateful for any help.
> 
> 
> Thank you very much!
> 
> David

R is not an algebra system but a system for numerical computations. You 
can write a function that represents (i.e. generates and returns) your 
matrix and uses its arguments to fill different elements of that matrix.

Best wishes,
Uwe