TLDR: I have a problem with tidyr::pivot_wider()
and suspect that it can be a bug of tidyr. I need alternative code with tidyr:: spread() of my code below to find out if it is a bug of tidyr or there is other problem. Or if you have an idea what can be wrong please provide your solution with tidyr::pivot_wider()
I cannot provide data for my code. My data contains 1694 rows, 11 variables, and missing values.
Here is my code:
temp_data_tibb <- temp_data_tibb %>%
pivot_wider(names_from = Month, id_cols = ID, values_from = c("var1", "var2", "var3", "var4", "var5", "var6", "var7", "var8", "var9"))
The problem is that if I subset part of my data than my code works fine. With full data it gave me errors like:
Error: Invalid type returned by `vec_proxy_compare()`.
Call `rlang::last_error()` to see a backtrace.
In addition: Warning messages:
1: Values in `var1` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(var1 = list)` to suppress this warning.
* Use `values_fn = list(var1 = length)` to identify where the duplicates arise
* Use `values_fn = list(var1 = summary_fun)` to summarise duplicates
and last 5 lines of error repeats for every variable from values_from =
. I tried to locate problematic row by gradually subseting and testing but cannot locate it because problem is not in a particular row.
Please provide alternative solution with tidyr:: spread() or provide other solution if you have one.