Entering edit mode
                    9.8 years ago
        viniciushs.z
        
    
        ▴
    
    20
    I would like to fuse 3 data frames (`AA`, `AB` and `BB`) which contain exactly the same dimensions and will never contain a number in the same coordinate (if one contain a number the others will contain a `NA`. Can also be true that a specific coordinate contain `NA` for all data frames). This is my input:
AA <- 'pr_id  sample1  sample2 sample3
                AX-1   NA       120     130    
                AX-2   NA       NA     NA
                AX-3   NA       NA     NA'
    AA <- read.table(text=AA, header=T)
    
    AB <- 'pr_id  sample1  sample2 sample3
                AX-1   100       NA     NA    
                AX-2   NA       180     NA
                AX-3   NA       120     NA'
    AB <- read.table(text=AB, header=T)
    
    BB <- 'pr_id  sample1  sample2 sample3
                AX-1   NA       NA     NA    
                AX-2   150       NA     NA
                AX-3   160       NA     NA'
    BB <- read.table(text=BB, header=T) 
My expected output:
    Fus <- 'pr_id  sample1  sample2 sample3
                AX-1   100       120     130    
                AX-2   150       180     160
                AX-3   160       120     NA'
    Fus <- read.table(text=Fus, header=T)
Some idea to perform this fusion?
Don't use loops in R
That's true :-)
My point was to give guidance rather than ready-to-use code.