R: Worm Plot Error in as.environment(DaTa) : invalid object for 'as.environment'

196 Views Asked by At

I am trying to create worm plots for a variety of linear regression models in R. The code is wp(modelL, bg="deeppink3"). Out of the nine worm plots I am attempting to create, it only works for two. The others bring the error message "Error in as.environment(DaTa) : invalid object for 'as.environment'".

I have already removed, reinstalled, and updated gamlss. I am not sure what else to do. Any help would be much appreciated.

1

There are 1 best solutions below

0
On

I have solved this problem - posting here unless anyone has this issue in the future.

I'm not sure why this worked, but I saved the original dataframe to a new one, i.e. dfx <- df

Then I created the models again, changing the data source from df to dfx. The worm plots suddenly worked.