knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
cat( badger::badge_cran_download("BMisc", "grand-total", "blue"), badger::badge_cran_download("BMisc", "last-month", "blue"), badger::badge_cran_release("BMisc", "blue"), badger::badge_devel("bcallaway11/BMisc", "blue"), badger::badge_cran_checks("BMisc"), badger::badge_last_commit("bcallaway11/BMisc") )
BMisc includes miscellaneous functions for working with panel data, quantiles, and printing results.
You can install BMisc from github with:
# install.packages("devtools") devtools::install_github("bcallaway11/BMisc")
or from CRAN with:
install.packages("BMisc")
One of the most useful functions in the BMisc
package is makeDist
which takes a vector of observations and turns them into a distribution function.
library(BMisc) y <- rnorm(100) y <- y[order(y)] u <- runif(100) u <- u[order(u)] F <- makeDist(y,u) class(F) ##plot(F)
Another useful function is the makeBalancedPanel
function which drops observations from a panel dataset which are not available in all time periods.
id <- rep(seq(1,100,1),2) ## individual ids for setting up a two period panel t <- rep(seq(1,2),100) ## time periods y <- rnorm(200) ## outcomes dta <- data.frame(id=id, t=t, y=y) ## make into data frame dta <- dta[-7,] ## drop the 7th row from the dataset (which creates an unbalanced panel) nrow(dta) dta <- makeBalancedPanel(dta, idname="id", tname="t") nrow(dta) ## now all the observations with missing data in any period are dropped
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.