Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkearney/tfse
๐ Useful R functions for various things
https://github.com/mkearney/tfse
data-science functions mkearney-r-package r-language rstats utility
Last synced: 27 days ago
JSON representation
๐ Useful R functions for various things
- Host: GitHub
- URL: https://github.com/mkearney/tfse
- Owner: mkearney
- License: other
- Created: 2016-07-03T11:10:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-04T16:31:50.000Z (over 5 years ago)
- Last Synced: 2024-08-13T07:15:28.444Z (4 months ago)
- Topics: data-science, functions, mkearney-r-package, r-language, rstats, utility
- Language: R
- Homepage: https://tfse.mikewk.com
- Size: 8.13 MB
- Stars: 18
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - mkearney/tfse - ๐ Useful R functions for various things (R)
README
---
output: github_document
---```{r, echo = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
set.seed(1234)
## load pkg
library(tfse)
```# tfse
[![Travis build status](https://travis-ci.org/mkearney/tfse.svg?branch=master)](https://travis-ci.org/mkearney/tfse)
[![Coverage status](https://codecov.io/gh/mkearney/tfse/branch/master/graph/badge.svg)](https://codecov.io/github/mkearney/tfse?branch=master)[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
Various useful functions for working with data and writing functions
## Install
Install from CRAN
```{r, eval=FALSE}
## from CRAN repo
install.packages("tfse")
```Install dev version from Github
```{r, eval=FALSE}
## from github
remotes::install_github("mkearney/tfse")
```## Usage
### Scales
Rescale to standard (0-1) scale
```{r}
## 0-1 scale
rescale_standard(-2:2)
```Rescale to normal (mean = 0; sd = 1) scale
```{r}
## z scores
rescale_normal(-2:2)
```Rescale to arbitrary lower/upper bounds
```{r}
## specify new scale bounds
rescale_pointscale(-2:2, 1, 10)
```### Citations
Print out the APA-formatted citation for R packages.
```{r}
## print out APA citation for {rtweet}
apa_citation("rtweet")
```### Annotate script files
Use `box_code()` to add a header-like chunk to your clipboardโpaste in script as desired.
```{r}
## store text in clipboard
box_code("EXAMPLE #1")## the pasted output:
##----------------------------------------------------------------------------##
## EXAMPLE #1 ##
##----------------------------------------------------------------------------##
```### Regular expressions
Get all regular expression matches (using easier looka-heads/look-behinds)
```{r}
## some text
x <- c("This *is* a test",
"#this *was* a test",
"This *will* be a test!",
"This *has been* a test; it *is* great.")## return text between asterisks, return as atomic vector
regmatches_(x, "(?<=\\*)\\S[^*]+(?=\\*)", drop = TRUE)
```### Github
Figure out the name of a Github repo for a given package
```{r}
## repo name of devtools
desc_gh_repo("devtools")
```Convert a Github link to the raw URL version
```{r}
## path to raw version of Github file
github_raw("https://github.com/mkearney/driven-snow/blob/master/theme/driven-snow.rstheme")
```## Help
View the help documentation
```{r, eval=FALSE}
## view R help documentatoin
help(package = "tfse")
```## about tfse
- This is my personal R package of utility functions
- Why *tfse*? The acronym was creatively reconfigured from its
originally intended state