Skip to contents

Get the average cross power on each segment in a SplicedView

Usage

ave_cross_power_spliceview(
  sv,
  columns,
  colour = "blue",
  segments = NULL,
  show_plot = FALSE,
  ...
)

Arguments

sv

SplicedView object

columns

column names in the data of each SplicedView object.

colour

name of colour on plots (default is 'blue').

segments

indices of segments to plot e.g. 1:10 (default plots up to first 10).

show_plot

show a plot (default is FALSE).

...

passed to analyze_coherency().

Value

data.frame with columns containing Average Cross Power for each segment.

Examples

r <- get_sample_recording()
d1 <- get_duration_annotation_data(r)
# only one relevant section for sample data
splicing_smile_df <- splice_time(d1, tier ='INTERACTION',
  comments = 'Mutual look and smile')

fv_list <- get_filtered_views(r, data_points = "Nose", n = 41, p = 3)
jv <- get_joined_view(fv_list)
sv_duration_smile <- get_spliced_view(jv, splicing_df = splicing_smile_df)
ave_cross_power_smile <- ave_cross_power_spliceview(
  sv_duration_smile, columns = c("Nose_x_Central_Sitar", "Nose_y_Central_Sitar"), show_plot = TRUE)
#> Warning: NaNs produced
#> 
  |                                                                            
  |                                                                      |   0%
#> Warning: NaNs produced
#> 
  |                                                                            
  |======================================================================| 100%

head(ave_cross_power_smile)
#>       Period Mutual look and smile
#> 1 0.08000000              4.348398
#> 2 0.08111676              5.137131
#> 3 0.08224911              6.032094
#> 4 0.08339726              7.036774
#> 5 0.08456144              8.151788
#> 6 0.08574188              9.374091