Error in storage.mode(x) : double list object cannot be coerced to type double
This error occurs when you try to store a list as a double. To fix it, you need to convert the list to a vector first, then store it as a double.
What is the error?
The error message “double list object cannot be coerced to type double” usually means that you are trying to coerce a list (or data frame) object into a atomic vector of mode “double”, but R doesn’t know how to do that. The simplest way to fix it is to extract the first element of the list, which will usually be the vector you’re trying to coerce.
For example, if you have a list with two elements, one of which is a vector of mode “double”, and you try to coerce the whole list into mode “double”, you’ll get this error message:
Error in double(mylist) :
double list object cannot be coerced to type double
But if you extract the first element of the list, which should be the vector you’re trying to coerce, it will work:
How to fix the error?
There are a few things that could be causing this error, but the most likely cause is that you’re trying to use a list object where a double value is expected. To fix this, simply convert the list object to a double value using the as.double() function. For example:
mylist <- 1:10 mylist_as_double <- as.double(mylist) If you’re still getting the same error after doing this, it’s possible that there is something else going on that we don’t know about. In that case, please post your entire code so we can take a look.
In conclusion, it appears that the error in storagemodex is caused by a double list object being coerced to type double. This can be fixed by simply changing the data type of the object to a list.