Independent T-Test: This test is used to compare the means of two independent groups. You can perform it using the t.test() function. For example, comparing the exam scores of two different groups:
t_test_result <- t.test(group1_scores, group2_scores)
Paired T-Test: Use this test when you have paired or matched data points. It assesses the difference between paired observations. You can perform it using the t.test() function. For example, comparing pre- and post-treatment scores:
paired_t_test_result <- t.test(before_treatment, after_treatment, paired = TRUE)