"Pivot longer"_Error: Can't combine `pclass` <character> and `sex` <double>. Run `rlang::last_error()` to see where the error occurred

Hi everyone,
I am getting an error.... and unfortunatelly can´t see what I am doing wrong...any ideas?

titanic %>%
pivot_longer(cols = everything(), names_to ="key", values_to = "value") %>%
ggplot(aes(x = value, color = "red", fill = "white")) +
geom_density (alpha = .7)
Error: Can't combine pclass and sex . Run rlang::last_error() to see where the error occurred

pclass and sex are of different types. probably int and character, so they can't live in the same column 'value' without being modified.

thanks! it works now

I think the credit and solution should be given to the person who reaaly provided the solution, in this case to @nirgrahamuk as:

is not a solution.

I would like to know what others think about it.

definitely ! Sorry ..... I am new in the platform, you are complete right. The credit is for @nirgrahamuk.

Thank you @tacoba for correcting it, that's nice. All the best,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.