[R] Time series and correlation

Marlin Keith Cox m@r||nkcox @end|ng |rom gm@||@com
Wed Apr 27 06:13:55 CEST 2022


Hi all, I have three columns. Resistance, Time and Frequency, and I need to
find correlations between Resistance and Time by each of 100 Frequencies.
I have set Frequencies to be a factor.  Time is in the format "%m/%d/%Y
%H:%M:%S", but correlations dont seem to like Time data.
I can run this code from Stackoverflow

library(plyr)
g <- data.frame(col1=rnorm(100, 1, 1), col2=rnorm(100, 10, 3),
col3=c(rep("a", 50), rep("b", 50)))

co <- ddply(g, .(col3), function(adf) cor(adf[,1], adf[,2]))

But if one of the columns is Time, it does not work.  So the functionality
of giving correlations by Frequency works, but not when Time is used.

I hope this is clear enough.

keith



M. Keith Cox, Ph.D.
Principal
MKConsulting
17415 Christine Ave.
Juneau, AK 99801
U.S. 907.957.4606

	[[alternative HTML version deleted]]



More information about the R-help mailing list