question
Hallo Carolyn
From what you describe you cannot calculate correlations.
You stated that you have two sets of data, one for December and one for March and that rows in one set is not related to the rows in another set and even persons tested in both months do not have their values on the same row. In that case cor is not appropriate. You should first adjust your data so that results of those 3 persons are on the same row but even after that only those 3 values could be evaluated by "cor".
From what you wrote I think that t.test or similar beast is the way you
should take. But without same data sample I may be wrong. Cheers Petr
-----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Carolyn J Miller
via
R-help Sent: Monday, January 30, 2023 7:16 PM To: r-help at r-project.org Subject: [R] question Hi guys, I am using the cor() function to see if there are correlations between
March
cortisol levels and December cortisol levels and I'm trying to figure out
if the
function is doing what I want it to do. Each sample has it's own separate row in the CSV file that I'm working out
of.
March Cort and December Cort are different columns and they come from separate samples, therefore their values would not be on the same row.
There
are only 3 individuals that have both December cort values and March
cortisol
values but they still have different sample ID values (from different
seasons) so
they are also not on the same row. I ran the function twice: once as cor(cortphcor, use = "complete.obs")
first
and then cor(cortphcor, use = "pairwise.complete.obs", method =
"pearson").
I received the same output both times. I guess what I'm asking is, is the
output
simply the correlation just for those 3 samples or is the second pairwise. complete.obs version giving me the correlation for all of the cort samples
for
March against all of the samples for December despite not being on the
same
row? I'm trying to figure out how many sample values are contributing to
the
correlation results I'm getting. Thanks, Carolyn [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.