To find the difference in ages of patient under 2 different groups (drug 1 and drug 2).
age_drug1
[1] 34 34 34 37 40 43 46 47 51 60 62 25 28 30 34 36 38 50 50 50 53 56 60 63
age_drug2
[1] 28 30 34 34 36 39 39 41 43 47 58 68 22 24 36 40 45 55 61
I have tried the Pearson correlation, since the distribution of the age in both groups were normal under Shapiro's test. However, when i try to do the correlation using Pearson's method, corr.test()
, it shows error
Error in cor.test.default(age_drug1, age_drug2, method = "pearson") :
'x' and 'y' must have the same length
Is there another way to check the association? I did try Student's t test unpaired, but I am not sure if that is the right option.
plot(density(age_drug2)); lines(density(age_drug1), col = "blue")
$\endgroup$