Code Monkey home page Code Monkey logo

pedant's Introduction

R-CMD-check

{pedant}

{pedant} lets you quickly transform R code to pedantically use explicit function calls instead of implicit, either by running add_double_colons() or using the handy RStudio addin "Make function calls explicit".

RStudio addin demo

RStudio addin demo

Installation

You can install the development version using

remotes::install_github("wurli/pedant")

Usage

If you’re developing a package, {pedant} will look at the DESCRIPTION and NAMESPACE files to work out which packages to use when making functions explicit. Otherwise it will use the currently attached packages, i.e. the ones already loaded using library(). You can manually specify the packages to look in using the use_packages argument to add_double_colons():

library(dplyr, warn.conflicts = FALSE)

code <- 
 "mtcars %>%
    filter(mpg > 20) %>%
    summarise(across(everything(), n_distinct))"

# Code will be transformed to use the double-colon operator, but notice
# that `n_distinct` is not transformed as it is not followed by `()`
cat(add_double_colons(code))
## mtcars %>%
##     dplyr::filter(mpg > 20) %>%
##     dplyr::summarise(dplyr::across(dplyr::everything(), n_distinct))

Why?

Often, during package development I forget to use explicit function calls and am then faced with the onerous task of cleaning up my own code. I wrote this package so I can continue this bad habit.

Bug reports / feature requests

Please post these as issues on github

pedant's People

Contributors

seblammers avatar

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.