Hi to everyone,
 
I would like to replace some values in a data.frame (D)

> str(D)
'data.frame':   116 obs. of  10 variables:
 $ X.     : int  1108 1591 3408 3872 5823 8099 10640 12600 14680 14698 ...
 $ media  : num  22 86.6 807 103.2 73 ...
 $ IE.2003: num  32 92 166 237 161 ...
 $ IE.2004: num  63 122.8 290 117.8 73.6 ...
 $ IE.2005: num  60 277 302 154 134 ...
 $ IE.2006: num  39 87 322 113 70 ...
 $ IE.2007: num  4 95 621 116 80 ...
 $ IE.2008: num  8 94 1071 90 74 ...
 $ IE.2009: num  16 81 1301 94 69 ...
 $ IE.2010: num  5 76 1225 1911 72 ...

D

    X.      media IE.2003 IE.2004 IE.2005 IE.2006 IE.2007 IE.2008 IE.2009 IE.2010
1   1108   22.00000    32.0    63.0    60.0      39     4.0       8      16     5.0
2   1591   86.60000    92.0   122.8   276.6      87    95.0      94      81    76.0
3   3408  807.00000   166.0   290.0   302.0     322   621.0    1071    1301  1225.0
4   3872  103.25000   237.2   117.8   154.4     113   116.0      90      94  1911.2
5   5823   73.00000   160.6    73.6   133.6      70    80.0      74      69    72.0
6   8099  125.16667   169.0   206.0   196.0     161   150.0      94      72    78.0
7  10640   67.33333   494.8   168.2   424.8     476   670.6      74      77    51.0
8  12600 2417.00000  1958.0  1871.0  1960.0    2383  2453.0    2506    2758  2442.0
9  14680   38.00000   142.2    46.0    30.0      61   404.0      42      19   243.8
10 14698  698.16667   505.0   482.0   553.0     664   847.0     800     679   646.0



WHat I really want to do is:

 for( i in 1: nrow(D))
 {
   for( j in 5:ncol(D))
   {
    D[((D[i,j]/D[i,2])>1.5)]15999)]<-1000000
   }
 
 }






Error en `[<-.data.frame`(`*tmp*`, (D[i, j]> 15999), value = 1e+06) : 
  missing values are not allowed in subscripted assignments of data frames 		 	   		  
	[[alternative HTML version deleted]]

