Skip to contents

Internally, the scalogram resulting from fcwt() is represented by a numeric matrix. This method coerces this matrix into a reasonable data frame. Note that this conversion has a significant run time cost.

Usage

# S3 method for class 'fcwtr_scalogram'
as.data.frame(x, ...)

Arguments

x

An object resulting from fcwt().

...

additional arguments to be passed to or from methods.

Value

A data.frame() object representing the scalogram data with four columns:

time_ind

An integer index uniquely identifying time slices.

time

The time difference to the first time slice in physical units. The time unit is the inverse of the frequency unit chosen by the user for the sample_freq argument of fcwt().

freq

The frequency in the same units as the sample_freq argument of fcwt().

value

The fCWT result for the particular time-frequency combination.

Examples

fcwt(
  sin((1:5000) * 2 * pi * 440 / 44100),
  sample_freq = 44100,
  n_freqs = 10
) |>
as.data.frame() |>
head()
#>   time_ind         time  freq        value
#> 1        0 0.000000e+00 22050           NA
#> 2        1 2.267574e-05 22050           NA
#> 3        2 4.535147e-05 22050 0.0025573892
#> 4        3 6.802721e-05 22050 0.0017304649
#> 5        4 9.070295e-05 22050 0.0011275189
#> 6        5 1.133787e-04 22050 0.0007753109