I have a big clinical data file with 96 columns like age, gender, BMI, etc
I want to see which of these clinical characteristics respond to chemotherapy. Response to chemotherapy divides patients to two groups as yes
and no
. Among these clinical characteristics, some are based on continuous data and some reflect `categorical data. Is it possible to write a function to loop over these characteristics and test for relationship between response to chemotherapy? Something like Wilcox test for continuous values and chi square for categorical characteristics. By hand, it takes too much to do for all one by one !
This is my data
ID response_to_chemo BMI Chemo Predictor DJANGO gender
AH/155 no 50 1 1 0 M
RS/022 no 67 1 1 0 M
RS/027 no 80 1 1 1 F
ST/023 no 65 1 1 0 M
SH/051 yes 47 1 1 0 M
AH/075 yes 90 0 1 0 M
RS/047 no 67 0 1 0 F
ST/029 no 61 1 1 0 F
For instance
myTable <- table(clin$gender, clin$response_to_chemo)
chisq.test(myTable)
Gives p-value for testing the relationship of gender (CATEGORICAL) in response to chemotherapy
And
t.test(clin$BMI ~ clin$response_to_chemo)
is for BMI
I meant a function calculating these p-values for clinical characteristics one by one