Auerbach-Lab/Behavior-autoanalysis

Newest version of dplyr (1.1) requires code changes

Opened this issue · 6 comments

In dplyr 1.1.0 main fails due to line 316's left_join argument all.x = TRUE
trial_data = dplyr::left_join(x = trial_data_encoded, y = dplyr::select(run_properties$stim_encoding_table, -Repeat_number, -``Delay (s)``), by = "Stim_ID", all.x = TRUE)

It works on the prior 1.0.10 version of dplyr.

In the newer 1.1 version, you get the fatal error:

Error in dplyr::left_join(x = trial_data_encoded, y = dplyr::select(run_properties$stim_encoding_table, :
... must be empty.
✖ Problematic argument:
• all.x = TRUE

If you remove the all.x = TRUE argument, the file processes with the additional warnings:

Warning: Returning more (or less) than 1 row per summarise() group was deprecated in dplyr 1.1.0.
ℹ Please use reframe() instead.
ℹ When switching from summarise() to reframe(), remember that reframe() always returns an ungrouped data frame and
adjust accordingly.
Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.
Warning: Returning more (or less) than 1 row per summarise() group was deprecated in dplyr 1.1.0.
ℹ Please use reframe() instead.
ℹ When switching from summarise() to reframe(), remember that reframe() always returns an ungrouped data frame and
adjust accordingly.
Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.
Analysis type: BBN Mixed Duration
Warning in left_join(need_evaluation, r, by = groupings) :
Each row in x is expected to match at most 1 row in y.
ℹ Row 1 of x matches multiple rows.
ℹ If multiple matches are expected, set multiple = "all" to silence this warning.

I have tried to roll back the computer experiencing these issues to 1.0.10 but it fails to build correctly.

In the mean time, I am not allowing UGs to use that computer

From tidyverse/dplyr#6262 or lionel-/lillies@6d0d31f

Don't supply all.x to left_join()
This is not an actual argument of left_join() and it is now stricter in what it accepts

I have managed to install the old version of dply on all the lab computers so I made this low priority.

https://dplyr.tidyverse.org/news/index.html

Changes I know will affect the code:

  • transmute() is superseded in favour of mutate(.keep = "none")
  • [case_when()] should now have .default = NULL that should replace TRUE ~
  • lines 1092 to 1103 I believe we just need to add the multiple = "all" but need to double check that its expected that there are more than 1 row mach in the 2 tables
  • if its expected that we should get a 1 row table, replace summarise with reframe. This may apply more generally when we expect summarise to change the number of rows
tofof commented

The all.x is fixed by 4be52ce. The summarize/reframe issue is still outstanding.

Warning: Returning more (or less) than 1 row per summarise() group was deprecated in dplyr 1.1.0.
i Please use reframe() instead.
i When switching from summarise() to reframe(), remember that reframe() always returns an ungrouped data frame and adjust accordingly.

This can be caused by a blank table return.
run_archive.zip

Reproduce:
Blue1 on 8/9/23 in supervisor-custom
line 598 (df_Rxn) returns a blank table at:
r %>% unnest(reaction) %>% dplyr::filter(task != "TH" & Dur (ms)== duration_current &Inten (dB) %in% c(55,65))
resulting in this warning.

Still Happening in Main so haven't closed yet:

Loading file... C:\Users\Noelle\AppData\Local\Temp\RtmpknhrcR/86765e9c027e6ce4c27df80c/0.mat
Stim file: BBN_20-80dB_100ms_8s
Trials: 473 Hit%: 84.3 FA%: 6.3
Warning: Returning more (or less) than 1 row per summarise() group was deprecated in dplyr 1.1.0.
ℹ Please use reframe() instead.
ℹ When switching from summarise() to reframe(), remember that reframe() always returns an ungrouped data frame and adjust accordingly.
Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.
Warning: Returning more (or less) than 1 row per summarise() group was deprecated in dplyr 1.1.0.
ℹ Please use reframe() instead.
ℹ When switching from summarise() to reframe(), remember that reframe() always returns an ungrouped data frame and adjust accordingly.
Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.
Analysis type: BBN (Standard)
Calculated run statistics.
Filename checks complete.
Weight checks complete.
Warning in Check_Performance_Cutoffs() : Low hit rate: 84.3%

Performance checks complete.
Archiving Run... Trials... Rat...
Run 20240127112732_178.192998468876_1.92546067375806 of Orange1 (#315) added to archives (in environment ONLY).

Run 20240127112732_178.192998468876_1.92546067375806 of Orange1 (#315) saved to disk.