# line of best model fit

Hi, I wonder if anyone can advise the right coding for exponential modelling in r.
I tried it below which has errors.

test.data
total_numbers weeks
1 0.01866667 0
2 0.16250000 0
3 8.26854655 2
4 9.56532400 3
5 13.76281219 4
6 15.12901143 5
7 17.21276351 6
8 12.26016050 7
9 9.95318961 8
10 13.08533422 9
11 14.03491319 10
12 16.45833712 11
13 9.44810147 12
14 23.01575763 13
15 20.74408497 14
16 24.78228333 15
17 23.15906638 16
18 20.99784066 17
19 20.35665044 18
20 28.07433125 19
21 21.40865476 20
22 24.20694359 21
23 22.35544110 22
24 23.92250613 23
25 29.12889246 24
26 19.14925403 25
27 22.57214125 26
28 38.88307866 27
29 34.77973102 28
30 19.19161723 29
31 20.86332812 30
32 20.23574283 31
33 27.33652342 33
34 13.95870164 34
35 21.69971318 35
36 17.47372640 36
37 19.29850251 37
38 15.79830778 38
39 30.33536649 39
40 16.47711096 40
41 19.96990699 41
42 10.01459846 42
43 32.94768262 43
44 14.30312611 44
45 23.50046121 45
46 14.75628965 46

## exponential model

theta.0 <- min(test.data\$total_numbers) * 0.5

# Estimate the rest parameters using a linear model

model.0 <- lm(log(test.data\$total_numbers - theta.0) ~ test.data\$weeks, data=test.data)
alpha.0 <- exp(coef(model.0)[1])
beta.0 <- coef(model.0)[2]
start <- list(alpha = alpha.0, beta = beta.0, theta = theta.0)
start
\$alpha
(Intercept)
5.562905

\$beta
test.data\$weeks
0.04133438

\$theta
[1] 0.009333333

model <- nls(total_numbers ~ alpha * exp(beta * weeks) + theta , data = test.data, start = start)
Error in nls(total_numbers ~ alpha * exp(beta * weeks) + theta, data = test.data, :
step factor 0.000488281 reduced below 'minFactor' of 0.000976562
summary(model)
Error in summary(model) : object 'model' not found
plot(test.data\$weeks, test.data\$total_numbers)
lines(test.data\$weeks, predict(model, list(weeks = test.data\$weeks)), col = 'skyblue', lwd = 3)
Error in predict(model, list(weeks = test.data\$weeks)) :