1:
:
dput(fit, control = c("quoteExpressions", "showAttributes"), file = "model.R")
?.deparseOpts
.
"quoteExpressions" // quote
, , . :
source
;call
"lm" - :
fit$call
, "quoteExpressions" R lm
. , , R dat_train
, R.
"showAttributes" - , "lm" . , , "", ? , "lm" , model
( ), qr
( QR-) terms
( ) .., . .
control
, :
control = c("keepNA", "keepInteger", "showAttributes")
. , "quoteExpressions", .
"keepInteger" "keepNA", "lm" .
------
2:
source
. :
fit1 <- source("model.R")$value
, summary
predict
. ?
- terms
fit1
"", ( , "" ""!). fit$terms
fit1$terms
, . ; "quoteExpressions". call
, terms
. terms
.
, :
fit1$terms <- terms.formula(fit1$terms)
fit$terms
(, , ), "terms".
""? . , , , .
, predict
( summary
):
predict(fit1) ## no `newdata` given, using model frame `fit1$model`
# 1 2 3 4
#1.03 2.01 2.99 3.97
predict(fit1, dat_score) ## with `newdata`
# 1 2
#1.52 3.48
-------
:
, , . "lm" , , , residuals
, fitted.values
, qr
model
/ . .