Giter Club home page Giter Club logo

packager's Introduction

PackageR

The goal of PackageR is to to help users better understand their package. When developing R packages, it’s easy to lose track of the scale of the project. This package provides functions to give developers a better insight into the number of functions, files, and their length. From here, developers can work to identify overly-complex functions or chokepoints and eventually write cleaner code.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("ARawles/packageR")

Example

To get a high-level understanding of the functions and files in your package, use the plot_ functions. These functions will produce ggplot2 graphics showing you a bit more about your package:

plot_function_length()

To access the data in a more raw format, use the list_functions() and list_x_files() functions:

list_functions()
#> [[1]]
#> [[1]]$name
#> [1] "file_length"
#> 
#> 
#> [[2]]
#> [[2]]$name
#> [1] "function_body"
#> 
#> 
#> [[3]]
#> [[3]]$name
#> [1] "function_info"
#> 
#> 
#> [[4]]
#> [[4]]$name
#> [1] "function_length"
#> 
#> 
#> [[5]]
#> [[5]]$name
#> [1] "function_list_to_tibble"
#> 
#> 
#> [[6]]
#> [[6]]$name
#> [1] "language_to_character"
#> 
#> 
#> [[7]]
#> [[7]]$name
#> [1] "library.dynam.unload"
#> 
#> 
#> [[8]]
#> [[8]]$name
#> [1] "list_functions"
#> 
#> 
#> [[9]]
#> [[9]]$name
#> [1] "list_r_files"
#> 
#> 
#> [[10]]
#> [[10]]$name
#> [1] "list_to_function_list"
#> 
#> 
#> [[11]]
#> [[11]]$name
#> [1] "plot_function_length"
#> 
#> 
#> [[12]]
#> [[12]]$name
#> [1] "system.file"
#> 
#> 
#> [[13]]
#> [[13]]$name
#> [1] "total_function_count"
#> 
#> 
#> [[14]]
#> [[14]]$name
#> [1] "total_function_length"

list_r_files()
#> [1] "man-roxygen/pkg.R" "R/files.R"         "R/functions.R"    
#> [4] "R/ne_utility.R"    "R/plot.R"          "R/total.R"        
#> [7] "R/utility.R"

By setting the info parameter to TRUE, you can retrieve more information about the functions:

list_functions(info = TRUE)[[1]]
#> $name
#> [1] "file_length"
#> 
#> $body
#> {
#>     length(readLines(path))
#> }
#> 
#> $length
#> [1] 1

packager's People

Contributors

arawles avatar

Stargazers

 avatar

Watchers

 avatar

packager's Issues

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.