My question is simple:
I've been trying to use pivot_longer
with values_ptypes
:
This is my code:
df <-mtcars %>% rownames_to_column()
df[1,] %>% pivot_longer(everything(),names_to = 'My Values', values_ptypes = list(rowname = 'character'))
df[1,] %>% pivot_longer(everything(),names_to = 'My Values', values_ptypes = list(rowname = as.character))
I have this message: Error: Can't combine rowname <character> and mpg <double>.
The idea of values_ptypes
is warning pivot_longer
that I have a column that is a character
, right?