SUSY computes synchrony as windowed cross-correlation based on two-dimensional time series, as described in Tschacher & Meier (2020).
install.packages("SUSY", repos="https://wtschacher.github.io/SUSY/")
Note that the following example assumes that the source data are in a flat file and it has particular structure (column names in first row, whitespace as field separator, at least 5 columns). If you do not have such, then use the command in the comment below to mockup random data.
library(SUSY)
## read in data from a flat file
= read.csv(file.choose(), header=TRUE, sep=" ", na.strings=".")
data
## mockup random data if needed
#data = as.data.frame(replicate(5, runif(10000, 300, 330)))
## compute SUSY for column 2 and column 5
= susy(data[, c(2, 5)], segment=30, Hz=15)
res names(res)
## compute SUSY for columns 1-2 and 3-4
= susy(data[, 1:4], segment=30, Hz=15)
res names(res)
## print all SUSY computations
res
## subset (and print) susy object to single results
1]
res[
## plot all SUSY computations, plot type 1
plot(res, type=1)
## plot only first SUSY computations, plot type 1 and 4
plot(res[1], type=c(1,4))
## plot only second SUSY computations, plot type 1, 2, 3, 4, 5
plot(res[2], type=1:5)
## compute SUSY for all permutations of columns
= susy(data, segment=30, Hz=15, permutation=TRUE)
res names(res)
## print legacy style
print(res, legacy=TRUE)
## export to flat file via data.frame and write.csv
= as.data.frame(res)
df df