Tools Inspired by 'Stata' to Manipulate Tabular Data

A set of tools inspired by 'Stata' to explore data.frames ('summarize', 'tabulate', 'xtile', 'pctile', 'binscatter', elapsed quarters/month, lead/lag).


Build Status CRAN_Status_Badge Coverage Status

This package contains R functions corresponding to useful Stata commands.

The package includes:

Some examples:

library(dplyr)
library(statar)
 
starwars %>% sum_up(height)
#─────────┼───────────────────────────────────────────────────────
#  height │       81        6  174.358  34.7704       66      264 
 
starwars %>% group_by(gender) %>% sum_up(height)
 
#>  gender │ Variable │      Obs  Missing     Mean   StdDev      Min      Max 
#>─────────┼──────────┼───────────────────────────────────────────────────────
#>  female │   height │       17        2  165.471  23.0302       96      213 
#>---------┼----------┼-------------------------------------------------------
#>hermap~e │   height │        1        0      175       NA      175      175 
#>---------┼----------┼-------------------------------------------------------
#>    male │   height │       59        3  179.237  35.3916       66      264 
#>---------┼----------┼-------------------------------------------------------
#>    none │   height │        1        1      200       NA      200      200 
#>---------┼----------┼-------------------------------------------------------
#>      NA │   height │        3        0      120  40.7063       96      167
 
starwars %>% tab(gender, eye_color)
 
#>       gender │     eye_color │    Freq.  Percent     Cum. 
#>──────────────┼───────────────┼────────────────────────────
#>       female │         black │        2     2.30     2.30 
#>       female │          blue │        6     6.90     9.20 
#>       female │         brown │        5     5.75    14.94 
#>       female │         hazel │        2     2.30    17.24 
#>       female │     red, blue │        1     1.15    18.39 
#>       female │       unknown │        1     1.15    19.54 
#>       female │         white │        1     1.15    20.69 
#>       female │        yellow │        1     1.15    21.84 
#>--------------┼---------------┼----------------------------
#>hermaphrodite │        orange │        1     1.15    22.99 
#>--------------┼---------------┼----------------------------
#>         male │         black │        7     8.05    31.03 
#>         male │          blue │       13    14.94    45.98 
#>         male │     blue-gray │        1     1.15    47.13 
#>         male │         brown │       16    18.39    65.52 
#>         male │          dark │        1     1.15    66.67 
#>         male │          gold │        1     1.15    67.82 
#>         male │ green, yellow │        1     1.15    68.97 
#>         male │         hazel │        1     1.15    70.11 
#>         male │        orange │        7     8.05    78.16 
#>         male │          pink │        1     1.15    79.31 
#>         male │           red │        2     2.30    81.61 
#>         male │       unknown │        2     2.30    83.91 
#>         male │        yellow │        9    10.34    94.25 
#>--------------┼---------------┼----------------------------
#>         none │         black │        1     1.15    95.40 
#>         none │           red │        1     1.15    96.55 
#>--------------┼---------------┼----------------------------
#>           NA │           red │        2     2.30    98.85 
#>           NA │        yellow │        1     1.15   100.00 

You can install

  • The latest released version from CRAN with

    install.packages("statar")
  • The current version from github with

    devtools::install_github("matthieugomez/statar")

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("statar")

0.6.5 by Matthieu Gomez, 8 months ago


https://github.com/matthieugomez/statar


Report a bug at https://github.com/matthieugomez/statar/issues


Browse source code at https://github.com/cran/statar


Authors: Matthieu Gomez [aut, cre]


Documentation:   PDF Manual  


GPL-2 license


Imports data.table, dplyr, ggplot2, lazyeval, matrixStats, methods, rlang, stringr, tidyr

Suggests knitr, lubridate, rmarkdown, testthat


See at CRAN