aravindhebbali / testlib

Demo R Package

Home Page:https://rsquaredacademy.github.io/testlib/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

testlib

Travis-CI Build Status AppVeyor Build Status CRAN_Status_Badge Coverage Status Project Status: Active - The project has reached a stable, usable state and is being actively developed. GitHub issues Twitter

Overview

testlib is a demo R package created to explore the different aspects of R package development. Hadley Wickham's book R Packages was used as a guide for developing this package. The package contains a function for creating two way tables of categorical data and visualizing such tables using bar and mosaic plots. Learn more in vignette("testlib") or ?cross_table.

Installation

testlib is not currently available from CRAN, but you can install the development version from github:

GitHub version

# install.packages("devtools")
devtools::install_github("rsquaredacademy/testlib")

Usage

The main function in the pacakge is cross_table() which creates two way tables of categorical data.

library(testlib)
k <- testlib::cross_table(mtcars$cyl, mtcars$am)
k
##     Cell Contents
##  |---------------|
##  |     Frequency |
##  |       Percent |
##  |       Row Pct |
##  |       Col Pct |
##  |---------------|
## 
##  Total Observations:  32 
## 
## -------------------------------------------------------------
## |              |                     am                     |
## -------------------------------------------------------------
## |          cyl |            0 |            1 |    Row Total |
## -------------------------------------------------------------
## |            4 |            3 |            8 |           11 |
## |              |        0.094 |         0.25 |              |
## |              |         0.27 |         0.73 |         0.34 |
## |              |         0.16 |         0.62 |              |
## -------------------------------------------------------------
## |            6 |            4 |            3 |            7 |
## |              |        0.125 |        0.094 |              |
## |              |         0.57 |         0.43 |         0.22 |
## |              |         0.21 |         0.23 |              |
## -------------------------------------------------------------
## |            8 |           12 |            2 |           14 |
## |              |        0.375 |        0.062 |              |
## |              |         0.86 |         0.14 |         0.44 |
## |              |         0.63 |         0.15 |              |
## -------------------------------------------------------------
## | Column Total |           19 |           13 |           32 |
## |              |        0.594 |        0.406 |              |
## -------------------------------------------------------------

License

License

About

Demo R Package

https://rsquaredacademy.github.io/testlib/

License:Other


Languages

Language:R 100.0%