0

I'm working on improving my skills for R and I'm quite confused on how to do this

clean_data <- data.frame %>%
  drop_na()

# Calculate means for each group
group_means <- clean_data %>%
  group_by(height) %>%
  summarise_all(mean)

# Print the group means
print(group_means)


# Calculate the difference between the two variables
data <- group_means %>%
  mutate(difference = 1 - 2)

# Print the updated data with the difference
print(data)


row_diff <- group_means[1, ] - group_means[2, ]

# Print the differences
print(row_diff) 

I'm not sure how to do the t-test part and is the above code correct. Do you guys have any recommendations on how a beginner can get better really quick. Thanks for the help

jrcalabrese
  • 2,184
  • 3
  • 10
  • 30
Nova
  • 1
  • 1
  • Please [see here on how to make a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), as we cannot reproduce your code, and please [see here about homework questions](https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions). Your first line calls upon something called `data.frame` -- is `data.frame` an object containing your data? I would also look into the [`t.test()`](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/t.test) function. – jrcalabrese Apr 23 '23 at 13:47

0 Answers0