Learn R Programming

Steve’s Miscellaneous Functions

{stevemisc} is an R package that includes various functions and tools that I have written over the years to assist me in my research, teaching, and public presentations (i.e. stuff I put on my blog). I offer it here for a public release because 1) I am vain and think I want an entire, eponymous ecosystem in the R programming language (i.e. the “steveverse”) and 2) I think there are tools here that are broadly useful for users that I’m trying to bundle with other things that I offer (prominently {steveproj}). Namely, {stevemisc} offers tools to assist in data organization, data presentation, data recoding, and data simulation.

Installation

You can install this on CRAN.

install.packages("stevemisc")

You can install the development version of {stevemisc} from Github via the {devtools} package. I suppose using the {remotes} package would work as well.

devtools::install_github("svmiller/stevemisc")

Copy Link

Version

Install

install.packages('stevemisc')

Monthly Downloads

415

Version

1.8.0

License

GPL (>= 2)

Maintainer

Steven Miller

Last Published

August 23rd, 2024

Functions in stevemisc (1.8.0)

ps_btscs

Create "peace years" or "spells" by cross-sectional unit, more generally
theme_steve_web

Legacy functions for Steve's Preferred ggplot2 Themes and Assorted Stuff
r1sd

Scale a vector by one standard deviation
r2sd

Scale a vector (or vectors) by two standard deviations
studentt

The Student-t Distribution (Location-Scale)
strategic_rivalries

Strategic Rivalries, 1494-2010
ps_spells

Create "spells" by cross-sectional unit, even more generally
rbnorm

Bounded Normal (Really: Scaled Beta) Distribution
rd_plot

Residual Density Plot for Linear Models
revcode

Reverse code a numeric variable
wls

Get Weighted Least Squares of Your OLS Model
map_quiz

Map Quiz Wrong Guesses Across Five Intro to IR Courses
prepare_refs

Prepare bib2df Data Frame for Formatting to Various Outputs
print_refs

Print and Format .bib Entries as References
sbayesboot

Bootstrap a Regression Model, the Bayesian Way
show_ranef

Get a caterpillar plot of random effects from a mixed model
sbtscs

Create "peace years" or "spells" by cross-sectional unit
normal_dist

Make and annotate a normal distribution with ggplot2
p_z

Convert the p-value you want to the z-value it actually is
mround

Multiply a Number by 100 and Round It (By Default: 2)
tbl_df

Convert data frame to an object of class "tibble"
stevepubs

An Incomplete List of My Publications, All of Which You Should Cite
smvrnorm

Simulate from a Multivariate Normal Distribution
%nin%

Find Non-Matching Elements
wom

Generate Week of the Month from a Date
usa_mids

United States Militarized Interstate Disputes (MIDs)
db_lselect

Lazily select variables from multiple tables in a relational database
ess9_labelled

Some Labeled Data in the European Social Survey (Round 9)
carrec

Recode a Variable
center_at

Scoped Helper Verbs
binred_plot

Generate a Binned-Residual Plot from a Fitted Generalized Linear Model
make_scale

Rescale Vector to Arbitrary Minimum and Maximum
cor2data

Simulate Data from Correlation Matrix
fra_leaderyears

French Leader-Years, 1874-2015
fct_reorg

Reorganize a factor after "re-leveling" it
charitable_contributions

Charitable Contributions Panel Data
corvectors

Create multivariate data by permutation
linloess_plot

Compare Linear Smoother to LOESS Smoother for Your OLS Model
filter_refs

Filter a Data Frame of Citations and Return the Entries as a Character
make_perclab

Make Percentage Label for Proportion and Add Percentage Sign
get_sims

Get Simulations from a Model Object (with New Data)
get_var_info

Get a small data frame of the variable label and values.
gmy_dyadyears

German Dyad-Years, 1816-2020
jenny

Set the Only Reproducible Seed That Matters