I'm using linear regression to attempt and forecast certain data. Even though there is no fault, it is strange. In order to forecast data2, which only has 1000 rows, I used a linear regression that I generated from data1, which has 4000 rows.

So, in my opinion, the variable's output should only contain 1000 rows. However, the 4000 variables never stop appearing. I have no idea what's wrong.

model = lm(train$latitude train$crashes)

Model, newdata = test, prediction1 = predict

data.frame = csv1

(Predicted = prediction1, Id = c(1:1000))

I infer from this code that it simply needs to forecast "test" data, which consists of 1000 rows. The statement reads, "Arguments suggest varied number of rows: 1000, 4337," though The train data in this instance has 4337 rows, hence the 4337.