[R] 2D Interpolation with missing values

Tolga Uzuner tolga.uzuner at gmail.com
Mon Nov 18 05:35:28 CET 2013


Dear R Users,
I have a 7x16 matrix with missing values. I'd like to do some kind of 
2-d surface fitting/interpolation to fill in the missing values, while 
guaranteeing that they are positive. Most grateful if someone could 
point me in the right direction.
Thanks in advance

Sample matrix below and attached as a .RData file.

 > foo
            1        2         3         4         5 6         7        
8        9       10       11        12       13
2         NA 55.75417        NA  43.44104  59.44768  55.34285 58.53618 
118.8807 111.1920 154.5540 127.3393  88.04989 241.7025
5         NA 77.64135  56.57198  61.53534 116.10166 136.96051 133.25444 
170.6501 241.7467 285.3510 357.0217 368.97401 477.4639
7   83.90995 93.68244  85.06739 131.15748 171.57145 147.81372 181.51127 
224.6683 275.8416 334.7789 386.1349 425.45739 458.5685
10        NA       NA 103.18350 161.03391 159.35678 168.12955 179.35892 
212.2448 270.1914 310.5895 360.8537 415.83569 479.2682
15        NA       NA        NA        NA 198.25427 168.32441 188.73329 
213.6808 225.3273 268.5376       NA        NA       NA
30        NA       NA        NA 136.19717 173.22215 169.56444 194.79908 
265.9728 295.3250 344.5198 310.4714        NA       NA
100       NA       NA        NA        NA        NA        NA NA       
NA       NA       NA       NA 500.12256       NA
           14       15       16
2   514.5015 559.6716       NA
5   645.0066 748.5740 831.9362
7   660.0408 828.3243 580.3799
10  520.8122 884.3661 705.2931
15        NA       NA       NA
30        NA       NA       NA
100       NA       NA       NA
 >


More information about the R-help mailing list