On 12/1/2023 11:47 AM, peter dalgaard wrote:
Also, and possibly more constructively, when you get an error like
CI.c = predict(mod2, data.frame( `plant-density` = x), interval = 'c')  # fail
Error in eval(predvars, data, env) : object 'plant-density' not found

you should check your assumptions. Does "newdata" actually contain a columnn called 
"plant-density":

Great advice/strategy. Thanks!


head(data.frame( `plant-density` = x))
   plant.density
1      65.00000
2      65.11912
3      65.23824
4      65.35736
5      65.47648
6      65.59560
I.e., it doesn't. So check help for data.frame and looking for something with 
names.

On 1 Dec 2023, at 01:47 , Bert Gunter <bgunter.4...@gmail.com> wrote:

"Thank you Rui.  I didn't know about the check.names = FALSE argument.
Another good reminder to always read help, but I'm not sure I understood
what help to read in this case"
?data.frame , of course, which says:

"check.names

logical. If TRUE then the names of the variables in the data frame are
checked to ensure that they are syntactically valid variable names and
are not duplicated. If necessary they are adjusted (by make.names) so
that they are. "

-- Bert

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to