For example, right now, I have to key in the t.test one at a time for each independent variables.
t.test(Age~composite_renal_march2020,data = DN_DKK3,var.equal=TRUE)
t.test(HbA1c~composite_renal_march2020,data = DN_DKK3,var.equal=TRUE)
I tried to pipe the following code to try to run t.test for the 2 variables simultaneously:
DN_DKK3 %>%
select(-SampleID) %>%
group_by(Age, HbA1c) %>%
t.test(~composite_renal_march2020, var.equal = TRUE)
However, the pipe code kept giving me this error message:
Error in
vec_c()
: ! Can't combinecomposite_renal_march2020
andRetinopathyGrade13
. Runrlang::last_trace()
to see where the error occurred.
Backtrace: ▆
- ├─... %>% t.test(~composite_renal_march2020, var.equal = TRUE)
- ├─stats::t.test(., ~composite_renal_march2020, var.equal = TRUE)
- └─stats:::t.test.default(., ~composite_renal_march2020, var.equal = TRUE)
- ├─x[xok]
- ├─dplyr:::
[.grouped_df
(x, xok) - ├─base::NextMethod()
- └─tibble:::
[.tbl_df
(x, xok) -
└─tibble:::tbl_subset_matrix(x, j, j_arg)
-
├─base::unname(vec_c(!!!values, .name_spec = ~.x))
-
└─vctrs::vec_c(!!!values, .name_spec = ~.x)
Warning message: In is.na(y) : is.na() applied to non-(list or vector) of type 'language'
I am stuck on how to solve this error message... hope to get some advice here. Thank you all so much!