I try to apply a function to a column of a dataframe but when I do this i got a column full of NA values. I don't understand why. Here is my code :
courbe <- function(x) exp(coef(regression)[1]*x+coef(regression[2]))
dataT[,c(2)] <- courbe(dataT[,c(1)])
And here my dataframe :
   DateRep Cases
1       25    NA
2       24    NA
3       23    NA
4       22    NA
5       21    NA
6       20    NA
7       19    NA
8       18    NA
9       17    NA
10      16    NA
11      15    NA
12      14    NA
13      13    NA
14      12    NA
15      11    NA
16      10    NA
17       9    NA
18       8    NA
19       7    NA
20       6    NA
21       5    NA
22       4    NA
23       3    NA
24       2    NA
25       1    NA
26       0    NA
The output of print(coef(regression)) :
Coefficients:
  (Intercept)  dataT$DateRep  
       2.7095         0.2211  
 
    