I am trying to rename the output variables from a Shapiro Wilks Test into a dataframe and then rename the output statistic and p value so I can merge it with other data.
dfSW_test_all <- df_data %>% shapiro_test(diff)
dfSW_test_all <- rename(SW_test_all, statistic = SW_diff_all, p = p_diff_all)
The following code runs
dfSW_test_all <- df_data %>% shapiro_test(diff)
Here is the str(dfSW_test_all)
tibble [1 × 3] (S3: tbl_df/tbl/data.frame)
** variable : chr "diff"**
** statistic: Named num 0.782**
** ..- attr(*, "names")= chr "W"**
** $ p : num 7.24e-11**
But this code
dfSW_test_all <- rename(SW_test_all, statistic = SW_diff_all, p = p_diff_all)
produces the following error:
Error in rename()
:
! Can't rename columns that don't exist.
Column
SW_diff_all
doesn't exist.
Run rlang::last_trace()
to see where the error occurred.