Kitty TX
Kitty TX

Reputation: 1

tidyverse spread function error

I've used the spread function in tidyverse before, and it worked fine. Now, however, it raises this error message for all uses of the spread function:

df <- data_frame(x = c('a', 'b'), y = 1:2)
df %>% spread(x, y) 

Error in synthetic.instrument(primary_id = primary_id, currency = currency, : object 'y' not found

Error in synthetic.instrument(primary_id = primary_id, currency = currency, : argument "memberratio" is missing, with no default

What is causing the error?

Upvotes: 0

Views: 195

Answers (1)

mustafa korucu
mustafa korucu

Reputation: 1

From what I managed to find about this topic on the net, I think the source of your problem might be due to the recent changes in tidyverse library. Trying out the pivot_wider() function in place of the spread function might work in your favor.

Something like this could work:

d_frame <- data_frame(x = c('a', 'b'), y = 1:2)
d_frame %>% pivot_wider(names_from = x, values_from = y)

Upvotes: 0

Related Questions