README.md

joeyr

A hodge-podge of useful functions.

Introduction

This is essentially my sandbox R Package. It has a hodge-podge of functions that I’ve used over the past several years. As I work with my sociophonetic data, I find myself running the same sorts of procedures over and over, so I often decide to write a generalized function to take care of that stuff in one line within a tidyverse pipeline.

The functions in joeyr can be grouped into about five different categories: the outlier detecters, sociophonetics functions, ggplot2 themes, the “grapes”, and other helpful functions. This README briefly explains them all.

Some of these functions I’ve generalized into something that others may find useful. Others are very specific to my own code and workflow so I’m not sure if they’ll be useful to you. Some functions are documented well but lots are not.

For questions, feel free to contact me at joey_stanley@byu.edu or on Twitter at @joey_stan.

Installation

This package can be downloaded to your computer by downloading it from Github.

#install.packages("devtools") # <- if not already installed
devtools::install_github("JoeyStanley/joeyr")

You can then load it like any other package.

library(joeyr)
## This is the "joeyr" package.

You’ll know you’ve got it installed properly when you see a little message saying This is the "joeyr" package..

Group 1: The Filter

The main function, and the reason I created the package in the first place, is find_outliers(). It implements a version of the Mahalanobis Distance, except it does so iteratively. After finding the distances for each point, it marks the furthest token as an outlier, and then recalculates the distance based on the remaining points. It continues this one-at-a-time procedure until a proportion of your data (that you’ve specified) has been removed.

For more details, see ?find_outliers. In the future I’ll write a vignette, blog post, or (perhaps some day) an article about it. For now, look at the help page or email me.

Group 2: Sociophonetics functions

Some functions in joeyr are useful for sociophonetic analysis. This first set includes what are essentially mathmatical functions in that they crunch some numbers.

There are three normalization procedures.

Finally, there are two functions are more about changing labels for phonemes and allophones.

Group 3: ggplot2 themes

These are currently not documented. The main one is theme_joey() which will produce plots using my own flavor of theme_bw(). There are some variants as well. The other helpful function is joey_arrow() which is just a shortcut for a type of arrow I like when I draw lines on a plot. I'll admit I don't really use these anymore.

Group 4: The grapes

“Grapes” refer to the type of R functions that are flanked on either side by %, like %in%. The ones here came about while writing my dissertation (or rather, the code used to analze the data for my dissertation) and were super helpful for that project.

Group 5: Other helpful functions

While writing my dissertation, I found myself doing the same sort of pipeline over and over so I just made a couple little shortcut functions to save myself some typing.

Depreciated functions

Previous versions of {joeyr} had a couple other tools, but recent versions of {tidyr} and {dplyr} have rendered them unnecessary. The following are no longer part of {joeyr}, though you can find the code on GitHub in the R_depreciated folder.

Citation

If you use this package, I would appreciate a citation. You can cite it as:

Stanley, Joseph A. joeyr: Functions for Vowel Data (R package version ###), 2023. https://joeystanley.github.io/joeyr/

Specifically, if you use the find_outliers() function, you can refer to it as something like "the Modified Mahalanobis Distance method implemented in Stanley (2020)."

Stanley, Joseph A. “The Absence of a Religiolect among Latter-Day Saints in Southwest Washington.” In Speech in the Western States: Volume 3, Understudied Varieties, by Valerie Fridland, Alicia Beckford Wassink, Lauren Hall-Lew, and Tyler Kendall, 95–122. Publication of the American Dialect Society 105. Durham, NC: Duke University Press, 2020. https://doi.org/10.1215/00031283-8820642.

Conclusion

That’s joeyr. I hope you find it useful!



JoeyStanley/joeyr documentation built on April 7, 2023, 8:37 p.m.