Title: | Frequency Profiles Computing and Plotting |
---|---|
Description: | Tools for generating an informative type of line graph, the frequency profile, which allows single behaviors, multiple behaviors, or the specific behavioral patterns of individual subjects to be graphed from occurrence/nonoccurrence behavioral data. |
Authors: | Robert Epstein [aut], Thomas Boulier [aut], Ronald E. Robertson [cre, aut], Jonathan Mejia [ctb], AIBRT [cph] |
Maintainer: | Ronald E. Robertson <[email protected]> |
License: | GPL-3 |
Version: | 0.0.2 |
Built: | 2025-03-12 04:31:54 UTC |
Source: | https://github.com/aibrt/freqprof |
Interpolate multiple columns of a data.frame
approxm(data1, n, method = "linear")
approxm(data1, n, method = "linear")
data1 |
a |
n |
the number of points to interpolate |
method |
the method to interpolate by, |
Returns a data.frame
of all data1
variables
interpolated to n
rows.
approx
is the underlying function and has more
options
Correlation test for multiple variables - of the same name - in separate data.frames
cor.testm(data1, data2, method)
cor.testm(data1, data2, method)
data1 |
a |
data2 |
a |
method |
a correlation method, either |
Returns a data.frame
of correlation test data for N variables
cor.test
is the underlying function and has more
options
Convert data to moving sum/prop.
freqprof(data.behavior, window = round(0.25 * nrow(data.behavior)), step = 1, resolution = 1, which = c("sum", "proportion"))
freqprof(data.behavior, window = round(0.25 * nrow(data.behavior)), step = 1, resolution = 1, which = c("sum", "proportion"))
data.behavior |
a data.frame containing occurrence/nonoccurrence data in binary (0/1) format |
window |
the window length to use in computing a moving sum or proportion |
step |
the number of bins of which the data will be translated. |
resolution |
the number of points contained in a bin |
which |
giving the moving function to apply: sum or proportion |
The data in a freqprof
object.
data(s58) freqprof(s58)
data(s58) freqprof(s58)
Generate a sequence of dates
generate_dates(startDate, nDays, by = "day")
generate_dates(startDate, nDays, by = "day")
startDate |
a character string in the format "YYYY-MM-DD" |
nDays |
length of output vector |
by |
days or weeks |
Sequence of dates starting at startDate with length nDays by daily or weekly increments
generate_dates("2016-06-05", 31, by = "day")
generate_dates("2016-06-05", 31, by = "day")
Internal ggplot Wrapper to Graph Frequency Profiles
ggplot_fp(data1, resolution = resolution, step = step, yAxis = yAxis, xAxisUnits = xAxisUnits, xmin = xmin, xmax = xmax, tick.every = tick.every, label.every = label.every)
ggplot_fp(data1, resolution = resolution, step = step, yAxis = yAxis, xAxisUnits = xAxisUnits, xmin = xmin, xmax = xmax, tick.every = tick.every, label.every = label.every)
data1 |
data formated into |
resolution |
resolution of |
step |
step size of |
yAxis |
a string providing a label for the y-axis. |
xAxisUnits |
a string indicating which unit has been used. By default, "sec". |
xmin |
x-axis minimum value |
xmax |
x-axis maximum value |
tick.every |
the spacing between each tick. By default, N/30 where N is the number of time units. |
label.every |
label every X ticks, where X = label.every. By default, label.every = 3. |
A ggplot of the frequency profile data in data1
This function reads a file, whose extension is either csv, bin or fpw, and imports it as a data.frame.
import_data(filename = file.choose())
import_data(filename = file.choose())
filename |
a string indicating the path of the file containing the data. By default, will open a pop-up so that the user can choose a file with the GUI. |
A data.frame ready to be converted into freqprof class (see function
freqprof
).
# Only run this example in interactive R sessions if(interactive()) { # Select a file import_data() }
# Only run this example in interactive R sessions if(interactive()) { # Select a file import_data() }
Kolmogorov-Smirnov test for multiple variables - of the same name - in separate data.frames
ks.testm(data1, data2, vars)
ks.testm(data1, data2, vars)
data1 |
a |
data2 |
a |
vars |
a |
Returns a data.frame
with Kolmogorov-Smivnov test data for N
variables
ks.test
is the underlying function and has more
options.
Internal function in freqprof
that is used to generate moving
sum or proportion data.
movfun(x, n, s, r, fun)
movfun(x, n, s, r, fun)
x |
data passed from |
n |
window length passed from |
s |
step size passed from |
r |
resolution passed from |
fun |
"sum" or "proportion" passed from |
Returns a list containing the processed data into $movfun, and the
associated panels into $panels. Passes list to freqprof
.
Use plot_freqprof
to plot frequency profile data generated from
freqprof
.
plot_freqprof(data.freqprof, yAxis = NULL, xAxisUnits = "sec", panel.in = TRUE, panel.out = TRUE, gg = FALSE, multiPlot = FALSE, tick.every = round(length(data.freqprof$data$time)/31), label.every = 3)
plot_freqprof(data.freqprof, yAxis = NULL, xAxisUnits = "sec", panel.in = TRUE, panel.out = TRUE, gg = FALSE, multiPlot = FALSE, tick.every = round(length(data.freqprof$data$time)/31), label.every = 3)
data.freqprof |
data formated into class |
yAxis |
a string labelling the y-axis, defaults to
|
xAxisUnits |
a string indicating x-axis units, defaults to "sec". |
panel.in |
if |
panel.out |
if |
gg |
if |
multiPlot |
if |
tick.every |
the spacing between each plot tick mark. By default, N/30 where N is the number of time units. |
label.every |
label every X ticks, where X = label.every. By default, label.every = 3. |
Returns a frequency profiles plot.
data(s58) plot_freqprof(freqprof(s58))
data(s58) plot_freqprof(freqprof(s58))
Internal function in freqprof
that is used to modify data resolution.
radj(x, r)
radj(x, r)
x |
data data passed from |
r |
resolution passed from |
Resolution adjustment.
Reads the data in the file "filename", which is supposed to be a .bin file
read.bin(filename)
read.bin(filename)
filename |
a string indicating the path of the file. |
A data.frame giving the raw data.
read.bin(filename = system.file("extdata", "S58-1-1.bin", package = "FreqProf"))
read.bin(filename = system.file("extdata", "S58-1-1.bin", package = "FreqProf"))
Reads the data in the file "filename", which is supposed to be a .fpw file
read.fpw(filename)
read.fpw(filename)
filename |
a string indicating the path of the file. |
A data.frame of the .fpw data.
Run interactive FreqProf example (Shiny App)
runEx()
runEx()
# Only run this example in interactive R sessions if(interactive()) { runEx() }
# Only run this example in interactive R sessions if(interactive()) { runEx() }
A dataset containing the occurrence/nonoccurence data for four behaviors of a single subject over 3092 observations. Each behavior corresponds to touches on areas of a touchpad.
s58
s58
A data.frame with 3092 rows and 4 variables
Behavior 1
Behavior 2
Behavior 3
Behavior 4