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

201,383

Version

5.2-3

License

GPL (>= 2)

Maintainer

Frank Harrell Jr

Last Published

March 16th, 2025

Functions in Hmisc (5.2-3)

Merge

Merge Multiple Data Frames or Data Tables
HmiscOverview

Overview of Hmisc Library
R2Measures

R2Measures
GiniMd

Gini's Mean Difference
Cs

Character strings from unquoted names
Fdebug

Debug Printing Function Generator
Hmisc-internal

Internal Hmisc functions
Lag

Lag a Numeric, Character, or Factor Vector
Misc

Miscellaneous Functions
Ecdf

Empirical Cumulative Distribution Plot
addggLayers

addggLayers
binconf

Confidence Intervals for Binomial Probabilities
addMarginal

Add Marginal Observations
biVar

Bivariate Summaries Computed Separately by a Series of Predictors
all.is.numeric

Check if All Elements in Character Vector are Numeric
aregImpute

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

Linear Extrapolation
Save

Faciliate Use of save and load to Remote Directories
abs.error.pred

Indexes of Absolute Prediction Error for Linear Models
areg

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

capitalize the first letter of a string
combplotp

Combination Plot
bpplot

Box-percentile plots
bystats

Statistics by Categories
completer

completer
ciapower

Power of Interaction Test for Exponential Survival
combine.levels

combine.levels
bpower

Power and Sample Size for Two-Sample Binomial Test
bootkm

Bootstrap Kaplan-Meier Estimates
cnvrt.coords

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

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

Element Merging
deff

Design Effect and Intra-cluster Correlation
describe

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

Representativeness of Observations in a Data Set
data.frame.create.modify.check

Tips for Creating, Modifying, and Checking Data Frames
csv.get

Read Comma-Separated Text Data Files
cut2

Cut a Numeric Variable into Intervals
curveRep

Representative Curves
contents

Metadata for a Data Frame
errbar

Plot Error Bars
ebpcomp

ebpcomp
escapeRegex

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

Enhanced Dot Chart
discrete

Discrete Vector tools
dotchart3

Enhanced Version of dotchart Function
dotchartpl

Enhanced Version of dotchart Function for plotly
mhgr

Miscellaneous Functions for Epidemiology
equalBins

Multicolumn Formating
ecdfSteps

ecdfSteps
estSeqMarkovOrd

estSeqMarkovOrd
event.chart

Flexible Event Chart for Time-to-Event Data
event.history

Produces event.history graph for survival data
event.convert

Event Conversion for Time-to-Event Data
extractlabs

extractlabs
estSeqSim

estSeqSim
fImport

fImport
first.word

First Word in a String or Expression
format.df

Format a Data Frame or Matrix for LaTeX or HTML
getRs

Interact with github rscripts Project
getHdata

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

Format P Values
colorFacet

Miscellaneous ggplot2 and grid Helper Functions
getZip

Open a Zip File From a URL
getabd

getabd
ggfreqScatter

Frequency Scatterplot
gbayes

Gaussian Bayesian Posterior and Predictive Distributions
ggplotlyr

ggplotlyr
find.matches

Find Close Matches
hashCheck

hashCheck
hlabs

hlabs
histboxp

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

Matrix of Hoeffding's D Statistics
gbayesSeqSim

gbayesSeqSim
geom_stepconfint

Step function confidence intervals for ggplot2
hist.data.frame

Histograms for Variables in a Data Frame
hdquantile

Harrell-Davis Distribution-Free Quantile Estimator
histbackback

Back to Back Histograms
hlab

hlab
impute

Generic Functions and Methods for Imputation
latex

Convert an S object to LaTeX, and Related Utilities
intMarkovOrd

intMarkovOrd
html

Convert an S object to HTML
label

Label Attribute of an Object
latestFile

latestFile
mChoice

Methods for Storing and Analyzing Multiple Choice Variables
list.tree

Pretty-print the Structure of a Data Object
htmltabv

htmltabc
mApply

Apply a Function to Rows of a Matrix or Vector
makeNstr

creates a string that is a repeat of a substring
na.delete

Row-wise Deletion na.action
hidingTOC

Moving and Hiding Table of Contents
knitrSet

knitr Setup and plotly Service Function
movStats

movStats
latexCheckOptions

Check whether the options for latex functions have been specified.
mdb.get

Read Tables in a Microsoft Access Database
na.detail.response

Detailed Response Variable Information
mtitle

Margin Titles
labcurve

Label Curves, Make Keys, and Interactively Draw Points and Curves
na.keep

Do-nothing na.action
pMedian

pMedian
latexTherm

Create LaTeX Thermometers and Colored Needles
latexDotchart

Enhanced Dot Chart for LaTeX Picture Environment with epic
legendfunctions

Legend Creation Functions
%nin%

Find Matching (or Non-Matching) Elements
meltData

meltData
pairUpDiff

pairUpDiff
nobsY

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

Box-Percentile Panel Function for Trellis
num.intercepts

Extract number of intercepts
nstr

Creates a string of arbitry length
multLines

Plot Multiple Lines
partition

Patitions an object into different sets
latexTabular

Convert a Data Frame or Matrix to a LaTeX Tabular
printL

printL
print.princmp

print.princmp
ordGroupBoot

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

qrxcenter
mgp.axis

Draw Axes With Side-Specific mgp Parameters
nCoincident

nCoincident
r2describe

r2describe
pc1

First Principal Component
plot.princmp

plot.princmp
plotlyM

plotly Multiple
popower

Power and Sample Size for Ordinal Response
plsmo

Plot smoothed estimates
rm.boot

Bootstrap Repeated Measurements Model
minor.tick

Minor Tick Marks
plotCorrM

plotCorrM
prnz

Print and Object with its Name
plotCorrPrecision

Plot Precision of Estimate of Pearson Correlation Coefficient
rmClose

rmClose
princmp

princmp
rMultinom

Generate Multinomial Random Variables with Varying Probabilities
prselect

Selectively Print Lines of a Text Vector
spikecomp

spikecomp
pstamp

Date/Time/Directory Stamp the Current Plot
spower

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

Matrix of Correlations and P-values
qcrypt

qcrypt
rcorr.cens

Rank Correlation for Censored Data
rcorrp.cens

Rank Correlation for Paired Predictors with a Possibly Censored Response, and Integrated Discrimination Index
rcspline.eval

Restricted Cubic Spline Design Matrix
runParallel

runParallel
runifChanged

runifChanged
rcspline.plot

Plot Restricted Cubic Spline Function
samplesize.bin

Sample Size for 2-sample Binomial
summarize

Summarize Scalars or Matrices by Cross-Classification
summary.formula

Summarize Data for Making Tables and Plots
rcspline.restate

Re-state Restricted Cubic Spline Function
reShape

Reshape Matrices and Serial Data
sedit

Character String Editing and Miscellaneous Character Handling Functions
seqFreq

seqFreq
print.char.list

prints a list of lists in a visually readable format.
scat1d

One-Dimensional Scatter Diagram, Spike Histogram, or Density
spss.get

Enhanced Importing of SPSS Files
sasxport.get

Enhanced Importing of SAS Transport Files using read.xport
simMarkovOrd

simMarkovOrd
summaryRc

Graphical Summarization of Continuous Variables Against a Response
simRegOrd

Simulate Power for Adjusted Ordinal Regression Two-Sample Test
simplifyDims

List Simplification
src

Source a File from the Current Working Directory
summaryS

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

soprobMarkovOrd
score.binary

Score a Series of Binary Variables
translate

Translate Vector or Matrix of Text Strings
smean.sd

Compute Summary Statistics on a Vector
trunc.POSIXt

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

soprobMarkovOrdm
summaryM

Summarize Mixed Data Types vs. Groups
print.char.matrix

Function to print a matrix with stacked cells
wtd.stats

Weighted Statistical Estimates
summaryP

Multi-way Summary of Proportions
transace

Additive Regression and Transformations using ace or avas
stat_plsmo

Add a lowess smoother without counfidence bands.
string.bounding.box

Determine Dimensions of Strings
stata.get

Enhanced Importing of STATA Files
redun

Redundancy Analysis
xYplot

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

Transformations/Imputations using Canonical Variates
string.break.line

Break a String into Many Lines at Newlines
symbol.freq

Graphic Representation of a Frequency Table
t.test.cluster

t-test for Clustered Data
rlegend

Special Version of legend for R
show.pch

Display Colors, Plotting Symbols, and Symbol Numeric Equivalents
tabulr

Interface to Tabular Function
showPsfrag

Display image from psfrag LaTeX strings
upFirst

Change First Letters to Upper Case
valueTags

Store Descriptive Information About an Object
sys

Run Unix or Dos Depending on System
solvet

solve Function with tol argument
somers2

Somers' Dxy Rank Correlation
stringDims

String Dimentions
varclus

Variable Clustering
subplot

Embed a new plot within an existing plot
vlab

vlab
testCharDateTime

testCharDateTime
yearDays

Get Number of Days in Year or Month
ynbind

Combine Variables in a Matrix
tex

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

Units Attribute of a Vector
xtfrm.labelled

Auxiliary Function Method for Sorting and Ranking
upData

Update a Data Frame or Cleanup a Data Frame after Importing
xy.group

Mean x vs. function of y in groups of x