Skip to content

Commit

Permalink
add barebones first drafts of roxygen
Browse files Browse the repository at this point in the history
these are really simple drafts -- i am putting no effort in to detail for any of them. rather, the point is so that they get added to NAMESPACE and get "exported" to the enviroment. this should make these functions accessible when using library(pathviewR). note that i have not done this for all functions; just the ones i have been using & editing
  • Loading branch information
vbaliga committed Jul 12, 2020
1 parent 2bfe798 commit ddb0901
Show file tree
Hide file tree
Showing 22 changed files with 813 additions and 19 deletions.
17 changes: 17 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
# Generated by roxygen2: do not edit by hand

export(bind_viewr_objects)
export(calc_vis_angle)
export(clean_viewr)
export(clean_viewr_batch)
export(gather_tunnel_data)
export(get_full_trajectories)
export(get_header_viewr)
export(import_and_clean_batch)
export(import_and_clean_viewr)
export(import_batch)
export(quick_separate_trajectories)
export(read_flydra_data)
export(read_motive_csv)
export(redefine_tunnel_center)
export(relabel_viewr_axes)
export(rename_viewr_characters)
export(rotate_tunnel)
export(select_x_percent)
export(separate_trajectories)
export(standardize_tunnel)
export(trim_tunnel_outliers)
export(visualize_frame_gap_choice)
37 changes: 36 additions & 1 deletion R/all_in_one_functions.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
## Part of the pathviewR package
## Last updated: 2020-07-11 VBB
## Last updated: 2020-07-12 VBB


################################# clean_viewr ##################################
## run through the pipeline for a single viewr object that has already been
## imported

## BAREBONES DRAFT OF ROXYGEN, NEEDS FURTHER DETAIL
#' For an imported viewr object, run through the cleaning pipeline as desired
#'
#' @param obj_name The viewr object to be processed
#' @param relabel_viewr_axes default TRUE,
#' @param gather_tunnel_data default TRUE,
#' @param trim_tunnel_outliers default TRUE,
#' @param standardization_option default "rotate_tunnel",
#' @param get_velocity default TRUE,
#' @param select_x_percent default TRUE,
#' @param separate_trajectories default TRUE,
#' @param get_full_trajectories default TRUE,
#' @param ... Additional arugments passed to any of the corresponding functions
#'
#' @return
#' @export

clean_viewr <- function(obj_name,
relabel_viewr_axes = TRUE,
gather_tunnel_data = TRUE,
Expand Down Expand Up @@ -223,6 +240,24 @@ or by removing the extraneous argument(s)")
## Use all of the preceding functions to construct an all-in-one function for
## ease of use.

## BAREBONES DRAFT OF ROXYGEN, NEEDS FURTHER DETAIL
#' Import a file and run through as many cleaning steps as desired.
#'
#' @param file_name Target file
#' @param file_id Optional
#' @param relabel_viewr_axes default TRUE,
#' @param gather_tunnel_data default TRUE,
#' @param trim_tunnel_outliers default TRUE,
#' @param standardization_option default TRUE,
#' @param get_velocity default TRUE,
#' @param select_x_percent default TRUE,
#' @param separate_trajectories default TRUE,
#' @param get_full_trajectories default TRUE,
#' @param ... Additional arguments passed to the corresponding functions.
#'
#' @return
#' @export

import_and_clean_viewr <- function(file_name,
file_id = NA,
relabel_viewr_axes = TRUE,
Expand Down
56 changes: 54 additions & 2 deletions R/batch_functions.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
## Part of the pathviewR package
## Last updated: 2020-07-11 VBB
## Last updated: 2020-07-12 VBB


################################# import_batch #################################
## Strictly importing, no further cleaning
##

## BAREBONES DRAFT OF ROXYGEN, NEEDS FURTHER DETAIL
#' Batch import of files for either Motive or Flydra (but not a mix of both)
#'
#' @param file_path_list A list of file paths
#' @param import_method Either "flydra" or "motive"
#' @param file_id Optional
#' @param subject_name For Flydra, the assigned subject name
#' @param frame_rate For Flydra, the assigned frame rate
#' @param simplify_marker_naming default TRUE; for Motive, whether marker naming
#' should be simplified
#' @param import_messaging default FALSE; should this function report each time
#' a file has been imported?
#' @param ... Additional arguments (may remove this if needed)
#'
#' @return
#' @export

import_batch <- function(file_path_list,
import_method = c("flydra", "motive"),
file_id = NA,
Expand Down Expand Up @@ -54,6 +71,17 @@ import_batch <- function(file_path_list,
## for a list of viewr files, run through the pipeline (from relabel axes
## up through get full trajectories, as desired) via clean_viewr()

## BAREBONES DRAFT OF ROXYGEN, NEEDS FURTHER DETAIL
#' For a list of viewr files, run through the pipeline (from relabel axes
#' up through get full trajectories, as desired) via clean_viewr()
#'
#' @param obj_list A list of viewr files (i.e. a list of tibbles)
#' @param ... Arguments to be passed in that specify how this function should
#' clean files.
#'
#' @return
#' @export

clean_viewr_batch <- function(obj_list,
...) {

Expand All @@ -72,6 +100,22 @@ clean_viewr_batch <- function(obj_list,
## Like clean viewr batch, but with import as the first step too
##

## BAREBONES DRAFT OF ROXYGEN, NEEDS FURTHER DETAIL
#' Like clean viewr batch, but with import as the first step too
#'
#' @param file_path_list A list of file paths
#' @param import_method Either "flydra" or "motive"
#' @param file_id Optional
#' @param subject_name For Flydra, the subject name applied to all files
#' @param frame_rate For Flydra, the frame rate applied to all files
#' simplified?
#' @param import_messaging Should this function report each time a file has been
#' processed?
#' @param ... Additional arguments to specify how data should be cleaned.
#'
#' @return
#' @export

import_and_clean_batch <- function(file_path_list,
import_method = c("flydra", "motive"),
file_id = NA,
Expand Down Expand Up @@ -123,10 +167,18 @@ import_and_clean_batch <- function(file_path_list,
## combine multiple viewr objects into a single viwer object
##

## BAREBONES DRAFT OF ROXYGEN, NEEDS FURTHER DETAIL
#' Combine multiple viewr objects into a single viwer object
#'
#' @param obj_list A list of viewr objects
#'
#' @return
#' @export

bind_viewr_objects <- function(obj_list) {

if (!"list" %in% class(obj_list)){
stop("obj_list must be a list of file locations")
stop("obj_list must be a list of viewr objects")
}

## THIS FUNCTION LIKELY NEEDS TO BE EDITED TO ACCOMODATE ATTRIBUTES FROM
Expand Down
15 changes: 14 additions & 1 deletion R/data_import_functions.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Part of the pathviewR package
## Last updated: 2020-07-01 VBB
## Last updated: 2020-07-12 VBB


############################### read_motive_csv ################################
Expand Down Expand Up @@ -314,6 +314,19 @@ problems.",
## Time is now encoded as a function of frame_rate and the specific labeling
## of frames within the imported flydra object

## BAREBONES DRAFT OF ROXYGEN, NEEDS FURTHER DETAIL
#' Import data from a MAT file exported from Flydra software
#'
#' @param mat_file The MAT file from Flydra
#' @param file_id (Optional) identifier for this file. If not supplied, this
#' defaults to \code{basename(file_name)}.
#' @param subject_name Name that will be assigned to the subject
#' @param frame_rate The capture frame rate of the session
#' @param ... Additional arguments
#'
#' @return
#' @export

read_flydra_data <-
function(mat_file,
file_id = NA,
Expand Down
Loading

0 comments on commit ddb0901

Please sign in to comment.