Dear list,

I have 9 repeated measures (measurement variable ==  'Delta13C') for
individuals (ID variable == 'Individual_ID'. Each repeated measure is
"indexed" (right term?) by the variable 'FeatherPosition' and given as
c('P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', 'P9'). I would like
to calculate a correlation coefficient (r) and p.value for all
measures of 'Delta13C' by individual. the function 'cor' only seems to
work when comparing two individual measures (e.g. P1 and P2, P2 and
P3, etc.) and only if I restructure my table. Any suggestions:

In SAS with 'proc corr' I would like results that look like:

Individual ID, r, p
WW_08I_01,-0.03,0.94
WW_08I_03,0.53,0.14

Trying to get started in R!
Keith

Sample dataset:

WW_Sample_SI <-
structure(list(Individual_ID = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("WW_08I_01",
"WW_08I_03"), class = "factor"), FeatherPosition = structure(c(1L,
2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
9L), .Label = c("P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8",
"P9"), class = "factor"), Delta13C = c(-18.3, -18.53, -19.55,
-20.18, -20.96, -21.08, -21.5, -17.42, -13.18, -22.3, -22.2,
-22.18, -22.14, -21.55, -20.85, -23.1, -20.75, -20.9)), .Names =
c("Individual_ID",
"FeatherPosition", "Delta13C"), class = "data.frame", row.names = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
"14", "15", "16", "17", "18"))

*******************************************************************************************
Keith Larson, PhD Student
Evolutionary Ecology, Lund University
Sölvegatan 37
223 62 Lund Sweden
Phone: +46 (0)46 2229014 Mobile: +46 (0)73 0465016 Fax: +46 (0)46 2224716
Skype: sternacaspia FB: keith.w.lar...@gmail.com

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to