0

May I ask you how can I compare a table (which has these attributes: initial machine name, destination machine name and incremental numeric ID) and an empty array (which has as attributes: arrival machine name in the columns and the target machine name start in lines).

If there is this correspondence between the departure and the arrival, then I have to fill with the incremental id value inside the array.

enter image description here

enter image description here

for (i in nrow(rownames(tabellaMatrice))) {
  for (j in ncol(colnames(tabellaMatrice))) {
    for (r in nrow(tab2$Da)) {
      ifelse(tab2$Da[r]==rownames(tabellaMatrice)[i],
             for (o in nrow(tab2$A)) {
               ifelse(tab2$A[o]==colnames(tabellaMatrice),
                      for (p in nrow(tab2$`Numero incrementale`)) {
                        tabellaMatrice[i,j]<-tab2$`Numero incrementale`[p]
                        
                      }
                      ,"")
               
             },"")
      
    }
    
  }
  
}

I'm trying to do this with for loops

I expect that inside the array is incremental id.

  • Welcome to StackOverflow. Can your post [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by providing your dataset using `dput()`? Please avoid posting images of data or code. – jrcalabrese Dec 09 '22 at 16:06

0 Answers0