Giter Site home page Giter Site logo

tfse's Introduction

tfse

Travis build status Coverage status

lifecycle

Various useful functions for working with data and writing functions

Install

Install from CRAN

## from CRAN repo
install.packages("tfse")

Install dev version from Github

## from github
remotes::install_github("mkearney/tfse")

Usage

Scales

Rescale to standard (0-1) scale

## 0-1 scale
rescale_standard(-2:2)
#> [1] 0.00 0.25 0.50 0.75 1.00

Rescale to normal (mean = 0; sd = 1) scale

## z scores
rescale_normal(-2:2)
#> [1] -1.2649111 -0.6324555  0.0000000  0.6324555  1.2649111

Rescale to arbitrary lower/upper bounds

## specify new scale bounds
rescale_pointscale(-2:2, 1, 10)
#> [1]  1.00  3.25  5.50  7.75 10.00

Citations

Print out the APA-formatted citation for R packages.

## print out APA citation for {rtweet}
apa_citation("rtweet")
#> �[32m↪�[39m �[38;5;244mAdding APA citation of {rtweet} to clipboard!�[39m
#> �[1m�[32m✔�[39m Ready to paste!�[22m
#> 
#> Kearney, M. W. (2018). rtweet: Collecting twitter data (R package version
#>     0.6.7) [Computer software]. The Comprehensive R Archive Network. Available
#>     from https://cran.r-project.org/package=rtweet

Annotate script files

Use box_code() to add a header-like chunk to your clipboard–paste in script as desired.

## 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)

## 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)
#> [1] "is"       "was"      "will"     "has been" "is"

Github

Figure out the name of a Github repo for a given package

## repo name of devtools
desc_gh_repo("devtools")
#> [1] "r-lib/devtools"

Convert a Github link to the raw URL version

## path to raw version of Github file
github_raw("https://github.com/mkearney/driven-snow/blob/master/theme/driven-snow.rstheme")
#> [1] "https://raw.githubusercontent.com/mkearney/driven-snow/master/theme/driven-snow.rstheme"

Help

View the help documentation

## 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

tfse's People

Contributors

mkearney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

carlboneri

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.