2
如何在输出中添加“mean =”,而不是R中的默认[1]?如何将“mean =”添加到输出中,而不是R中的默认[1]?
Test_scores <- c(50,75,80,90,99,93,65,85,95,87) #created matrix
Hours_studied <- c(.1,.5,.6,1,3,3.5,.5,1,2,2.5)
grade_study <- cbind(Test_scores,Hours_studied) #combined into one matrix
return(grade_study)
summarystat <- function(x) { #make a function to output the mean, median, sd with the output labeled (ex: mean=)
print(mean(x)),
print (median(x))
print(sd(x))
}