I use cast()
from the reshape
package quite frequently. Almost every time, this warning pops up:
Aggregation requires fun.aggregate: length used as default
I've tried to set options( warn =-1)
, to no avail. How does one suppress these warnings?
You could manually specify fun.aggregate to be length.
cast(your_inputs_to_cast, fun.aggregate = length)
Aggregation requires fun.aggregate: length used as default
is message
not a warning
- letting you know that the function as decided something for you. I think the best option is @Dason's answer - i.e. to manually specify this option.
However, If you don't want to do that:
You can suppress messages by wrapping the function in suppressMessages
Using the example from cast
names(ChickWeight) <- tolower(names(ChickWeight))
chick_m <- melt(ChickWeight, id=2:4, na.rm=TRUE)
suppressMessages(cast(chick_m, time ~ variable))
Or you could create your own function
cast_suppress <- function(...){suppressMessages(cast(...))}
cast_suppress(chick_m, time ~ variable)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With