I want to run a rhythm analysis on a dataframe of 65 columns and >1000 lines. I have samples every 4h for 48 hours. As an example, my dataframe looks like this:
set.seed(123)
example_df <- data.frame(matrix(sample(1:1000, 10 * 65), nrow = 10, ncol = 65))
colnames(example_df) <- paste0(rep(paste0("T",c(seq(from=1,to=13,by=1))),each=5),rep(paste0("_Individual",c(seq(from=1,to=5,by=1))),times=5))
When I look for 24h +/- 4h periods, no problem, the code works:
results_24 <- rain(t(example_df), deltat=4, period=24,period.delta=4,peak.border = c(0.3, 0.7),
nr.series=5,method = "longitudinal",adjp.method="ABH",verbose=T)
But I cannot search for 12 +/- 2 hours periods with this setting:
results_12 <- rain(t(example_df), deltat=4, period=12,period.delta=2,peak.border = c(0.3, 0.7),
nr.series=5,method = "longitudinal",adjp.method="ABH",verbose=T)
I get the error: "Error in peakl[[x]] : subscript out of bounds"
Globally, anything below 14 does not work. I understand there is an index not matching there, but why?
Also, secondary question: it works if I use the "Independent" method. And I have used it before perfectly well. But I don't think I can do that here. Because I use tissue cultures as follow: one big culture of each individual has been seeded in 13 different wells, and sampled over time. So I think that this is not independent, correct? I believe it would be pseudoreplicates of the same individual otherwise.
Any thought on 1) how to solve the error? 2) should I go for an independent method instead?
Thanks!
sessionInfo( ) R version 4.2.3 (2023-03-15 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22621)