lundi 9 novembre 2020

How to change some values in table of matrix using conditions in R?

I wrote this but it is not correct

  L=1.127
    for(i in 1:length(data)){
    if data[i]>forecast22[i]& (data [i]-forecast22[i])>=L/3
    forecast22[i]=forecast22[i]+L/2
    if data[i]<forecast22[i]& (data [i]-forecast22[i])>=L/3
    forecast22[i]=forecast22[i]-L/2
    }

How to write the correct code

Aucun commentaire:

Enregistrer un commentaire