Learn R Programming

Hmisc

Harrell Miscellaneous

Current Goals

Web Sites

To Do

  • Consider using the haven package for importing SAS, Stata, and SPSS files; haven stores labels as the label attribute of each variable as does Hmisc; it converts date and time variables automatically and allows one to specify a format catalog along with the primary dataset
  • See if the readstata13 package has advantages over the foreign package for Stata file import
  • Consider creating xl.get using the readxl package to read .xls and .xlsx Excel files
  • In impute.transcan, sense if a variable in data is not a factor whereas it was treated as a factor during aregImpute; it should be converted to factor before the line v[sub] <- ... levels(as.integer...)) is run

Copy Link

Version

Install

install.packages('Hmisc')

Monthly Downloads

247,111

Version

5.3-0

License

GPL (>= 2)

Maintainer

Frank Harrell Jr

Last Published

September 6th, 2026

Functions in Hmisc (5.3-0)

GiniMd

Gini's Mean Difference
Merge

Merge Multiple Data Frames or Data Tables
Lag

Lag a Numeric, Character, or Factor Vector
Hmisc-internal

Internal Hmisc functions
HmiscOverview

Overview of Hmisc Library
Misc

Miscellaneous Functions
Ecdf

Empirical Cumulative Distribution Plot
R2Measures

R2Measures
Fdebug

Debug Printing Function Generator
Cs

Character strings from unquoted names
approxExtrap

Linear Extrapolation
addggLayers

addggLayers
all.is.numeric

Check if All Elements in Character Vector are Numeric
Save

Faciliate Use of save and load to Remote Directories
binconf

Confidence Intervals for Binomial Probabilities
areg

Additive Regression with Optimal Transformations on Both Sides using Canonical Variates
addMarginal

Add Marginal Observations
aregImpute

Multiple Imputation using Additive Regression, Bootstrapping, and Predictive Mean Matching
biVar

Bivariate Summaries Computed Separately by a Series of Predictors
abs.error.pred

Indexes of Absolute Prediction Error for Linear Models
bpplot

Box-percentile plots
combine.levels

combine.levels
combplotp

Combination Plot
completer

completer
bystats

Statistics by Categories
ciapower

Power of Interaction Test for Exponential Survival
cnvrt.coords

Convert between the 5 different coordinate sytems on a graphical device
bpower

Power and Sample Size for Two-Sample Binomial Test
capitalize

capitalize the first letter of a string
bootkm

Bootstrap Kaplan-Meier Estimates
deff

Design Effect and Intra-cluster Correlation
cpower

Power of Cox/log-rank Two-Sample Test
consolidate

Element Merging
dataRep

Representativeness of Observations in a Data Set
cut2

Cut a Numeric Variable into Intervals
csv.get

Read Comma-Separated Text Data Files
data.frame.create.modify.check

Tips for Creating, Modifying, and Checking Data Frames
describe

Concise Statistical Description of a Vector, Matrix, Data Frame, or Formula
contents

Metadata for a Data Frame
curveRep

Representative Curves
mhgr

Miscellaneous Functions for Epidemiology
ecdfSteps

ecdfSteps
errbar

Plot Error Bars
ebpcomp

ebpcomp
dualSD

Dual Standard Deviations
dotchart2

Enhanced Dot Chart
equalBins

Multicolumn Formating
dotchart3

Enhanced Version of dotchart Function
dotchartpl

Enhanced Version of dotchart Function for plotly
discrete

Discrete Vector tools
escapeRegex

Escapes any characters that would have special meaning in a reqular expression.
estSeqMarkovOrd

estSeqMarkovOrd
estSeqSim

estSeqSim
fImport

fImport
first.word

First Word in a String or Expression
extractlabs

extractlabs
find.matches

Find Close Matches
event.convert

Event Conversion for Time-to-Event Data
event.history

Produces event.history graph for survival data
event.chart

Flexible Event Chart for Time-to-Event Data
getZip

Open a Zip File From a URL
gbayesSeqSim

gbayesSeqSim
getabd

getabd
colorFacet

Miscellaneous ggplot2 and grid Helper Functions
format.pval

Format P Values
gbayes

Gaussian Bayesian Posterior and Predictive Distributions
geom_stepconfint

Step function confidence intervals for ggplot2
getHdata

Download and Install Datasets for Hmisc, rms, and Statistical Modeling
format.df

Format a Data Frame or Matrix for LaTeX or HTML
getRs

Interact with github rscripts Project
hashCheck

hashCheck
hidingTOC

Moving and Hiding Table of Contents
histboxp

Use plotly to Draw Stratified Spike Histogram and Box Plot Statistics
hlabs

hlabs
ggplotlyr

ggplotlyr
hlab

hlab
hdquantile

Harrell-Davis Distribution-Free Quantile Estimator
ggfreqScatter

Frequency Scatterplot
hist.data.frame

Histograms for Variables in a Data Frame
histbackback

Back to Back Histograms
label

Label Attribute of an Object
htmltabv

htmltabc
intMarkovOrd

intMarkovOrd
knitrSet

knitr Setup and plotly Service Function
latestFile

latestFile
hoeffd

Matrix of Hoeffding's D Statistics
html

Convert an S object to HTML
labcurve

Label Curves, Make Keys, and Interactively Draw Points and Curves
impute

Generic Functions and Methods for Imputation
latex

Convert an S object to LaTeX, and Related Utilities
mApply

Apply a Function to Rows of a Matrix or Vector
legendfunctions

Legend Creation Functions
latexCheckOptions

Check whether the options for latex functions have been specified.
latexDotchart

Enhanced Dot Chart for LaTeX Picture Environment with epic
list.tree

Pretty-print the Structure of a Data Object
mChoice

Methods for Storing and Analyzing Multiple Choice Variables
latexTabular

Convert a Data Frame or Matrix to a LaTeX Tabular
latexTherm

Create LaTeX Thermometers and Colored Needles
makeNstr

creates a string that is a repeat of a substring
mdb.get

Read Tables in a Microsoft Access Database
na.keep

Do-nothing na.action
meltData

meltData
nCoincident

nCoincident
movStats

movStats
minor.tick

Minor Tick Marks
mtitle

Margin Titles
na.delete

Row-wise Deletion na.action
multLines

Plot Multiple Lines
pairUpDiff

pairUpDiff
num.intercepts

Extract number of intercepts
pMedian

pMedian
ordGroupBoot

Minimally Group an Ordinal Variable So Bootstrap Samples Will Contain All Distinct Values
plotp

Generic Method for Making Plotly Graphics
plotlyM

plotly Multiple
princmp

princmp
plot.princmp

plot.princmp
plotlyParm

Parameters for Plotly Graphics
plotCorrM

plotCorrM
plotlySave

Save a Plotly Graphic to PNG
na.detail.response

Detailed Response Variable Information
mgp.axis

Draw Axes With Side-Specific mgp Parameters
%nin%

Find Matching (or Non-Matching) Elements
plotCorrPrecision

Plot Precision of Estimate of Pearson Correlation Coefficient
pc1

First Principal Component
partition

Patitions an object into different sets
r2describe

r2describe
qrxcenter

qrxcenter
print.princmp

print.princmp
printL

printL
plsmo

Plot smoothed estimates
qcrypt

qcrypt
nstr

Creates a string of arbitry length
nobsY

Compute Number of Observations for Left Hand Side of Formula
panel.bpplot

Box-Percentile Panel Function for Trellis
popower

Power and Sample Size for Ordinal Response
pstamp

Date/Time/Directory Stamp the Current Plot
prnz

Print and Object with its Name
prselect

Selectively Print Lines of a Text Vector
print.char.matrix

Function to print a matrix with stacked cells
print.char.list

prints a list of lists in a visually readable format.
rcorr.cens

Rank Correlation for Censored Data
rlegend

Special Version of legend for R
rMultinom

Generate Multinomial Random Variables with Varying Probabilities
rcspline.restate

Re-state Restricted Cubic Spline Function
reShape

Reshape Matrices and Serial Data
rcorr

Matrix of Correlations and P-values
redun

Redundancy Analysis
rcspline.plot

Plot Restricted Cubic Spline Function
rcspline.eval

Restricted Cubic Spline Design Matrix
rcorrp.cens

Rank Correlation for Paired Predictors with a Possibly Censored Response, and Integrated Discrimination Index
seqFreq

seqFreq
rmClose

rmClose
runifChanged

runifChanged
sedit

Character String Editing and Miscellaneous Character Handling Functions
runParallel

runParallel
score.binary

Score a Series of Binary Variables
sasxport.get

Enhanced Importing of SAS Transport Files using read.xport
samplesize.bin

Sample Size for 2-sample Binomial
rm.boot

Bootstrap Repeated Measurements Model
scat1d

One-Dimensional Scatter Diagram, Spike Histogram, or Density
smean.sd

Compute Summary Statistics on a Vector
soprobMarkovOrd

soprobMarkovOrd
soprobMarkovOrdm

soprobMarkovOrdm
simMarkovOrd

simMarkovOrd
simplifyDims

List Simplification
show.pch

Display Colors, Plotting Symbols, and Symbol Numeric Equivalents
somers2

Somers' Dxy Rank Correlation
simRegOrd

Simulate Power for Adjusted Ordinal Regression Two-Sample Test
showPsfrag

Display image from psfrag LaTeX strings
solvet

solve Function with tol argument
stringDims

String Dimentions
stat_plsmo

Add a lowess smoother without counfidence bands.
spikecomp

spikecomp
spss.get

Enhanced Importing of SPSS Files
string.bounding.box

Determine Dimensions of Strings
subplot

Embed a new plot within an existing plot
string.break.line

Break a String into Many Lines at Newlines
stata.get

Enhanced Importing of STATA Files
spower

Simulate Power of 2-Sample Test for Survival under Complex Conditions
src

Source a File from the Current Working Directory
symbol.freq

Graphic Representation of a Frequency Table
sys

Run Unix or Dos Depending on System
t.test.cluster

t-test for Clustered Data
summaryS

Summarize Multiple Response Variables and Make Multipanel Scatter or Dot Plot
tabulr

Interface to Tabular Function
summaryP

Multi-way Summary of Proportions
summaryM

Summarize Mixed Data Types vs. Groups
summaryRc

Graphical Summarization of Continuous Variables Against a Response
summarize

Summarize Scalars or Matrices by Cross-Classification
summary.formula

Summarize Data for Making Tables and Plots
typstFunctions

Typst Utility Function Definitions
testCharDateTime

testCharDateTime
typstDotchart

Enhanced Dot Chart Rendered as Typst Markup
typstAsis

Emit Raw Typst Markup Without Requiring results='asis'
typstTranslate

Translate a Character String for Typst Markup
translate

Translate Vector or Matrix of Text Strings
trunc.POSIXt

Return the floor, ceiling, or rounded value of date or time to specified unit.
transace

Additive Regression and Transformations using ace or avas
tex

function for use in graphs that are used with the psfrag package in LaTeX
transcan

Transformations/Imputations using Canonical Variates
upData

Update a Data Frame or Cleanup a Data Frame after Importing
xtfrm.labelled

Auxiliary Function Method for Sorting and Ranking
upFirst

Change First Letters to Upper Case
vlab

vlab
xYplot

xyplot and dotplot with Matrix Variables to Plot Error Bars and Bands
units

Units Attribute of a Vector
xy.group

Mean x vs. function of y in groups of x
varclus

Variable Clustering
valueTags

Store Descriptive Information About an Object
ynbind

Combine Variables in a Matrix
yearDays

Get Number of Days in Year or Month
wtd.stats

Weighted Statistical Estimates