Home > Net >  Simple algebraic equation in R
Simple algebraic equation in R

Time:10-02

I need R to give the result of the following equation depending on x and y:

(xy8) (xy4) (xy3.3)

Can you help me figure that out?

CodePudding user response:

You really need to do some reading and learning for yourself as this is pretty much the first step...

x <- 1 # assign a number to a new variable `x`
y <- 2 # assign a number to a new variable `x`

(x*y*8) (x*y*4) (x*y*3.3) #do the sum

<- assign # comment

CodePudding user response:

You can create a function since the x and y may be varying from time to time.

Example;try the following code.

Answer<-function(x,y){Z<-(xy8) (xy4 (xy3.3);z} Answer(1,2) ##[1] 30.6

The function requires two arguments i.e x and y.It saves time.

  •  Tags:  
  • r
  • Related