Learn R Programming

⚠️There's a newer version (0.7.6) of this package.Take me there.

statar (version 0.1.3)

Tools inspired by Stata to manipulate tabular data

Description

statar makes it easier to work with tabular datasets. The package includes a set of functions to clean and summarize variables, to join datasets using an SQL-syntax, to manipulate datasets with a panel structure (elapsed dates, lead/lag, rolling functions, fill in missing values based on previous dates, add rows for missing dates). The package also includes functions to emulate Stata and Julia string and expression interpolation. statar is based on the data.table package and is inspired by Stata.

Copy Link

Version

Install

install.packages('statar')

Monthly Downloads

718

Version

0.1.3

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Matthieu Gomez

Last Published

January 8th, 2015

Functions in statar (0.1.3)

winsorize

Winsorize a numeric vector
setmutate

Version of mutate that (i) transforms data.table in place (ii) allows by, i condition
demean

Demean a vector
join

Join two data.tables together
statar

A package for applied research
sum_up

Gives summary statistics (corresponds to Stata command summarize)
roll_lag

Apply rollling functions with respect to a time variable
graph

Experimental function to graph a dataset
lead-lag

lead and lag with respect to a time variable
setmutate_each

Version of mutate_each that (i) transforms data.table in place (ii) allows by, i condition (iii) when only when fun, creates new variables - except when replace = TRUE
setdrop

Drop certain columns in place
fill_gap

Add rows corresponding to gaps in some variable
floor_date

floor_date Round date-times down.
sample_mode

Statistical mode
tempname

Create unique names within a list, a data.frame, or an environment
bin

Bin a numeric vector and return integer codes for the binning (corresponds to Stata command xtile)
pastem

String and expression interpolation
tag

Creates a vector of zero except for one subscript
find_duplicates

returns duplicated rows
setna

fill NA in place based on non missing observations
setkeep

Keep only certain columns in place
elapsed

Elapsed dates (monthly, quarterly)