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

168,211

Version

5.2-2

License

GPL (>= 2)

Maintainer

Frank Harrell Jr

Last Published

January 10th, 2025

Functions in Hmisc (5.2-2)

Lag

Lag a Numeric, Character, or Factor Vector
Cs

Character strings from unquoted names
R2Measures

R2Measures
Save

Faciliate Use of save and load to Remote Directories
Merge

Merge Multiple Data Frames or Data Tables
Misc

Miscellaneous Functions
Ecdf

Empirical Cumulative Distribution Plot
addggLayers

addggLayers
GiniMd

Gini's Mean Difference
HmiscOverview

Overview of Hmisc Library
abs.error.pred

Indexes of Absolute Prediction Error for Linear Models
binconf

Confidence Intervals for Binomial Probabilities
aregImpute

Multiple Imputation using Additive Regression, Bootstrapping, and Predictive Mean Matching
Hmisc-internal

Internal Hmisc functions
bpower

Power and Sample Size for Two-Sample Binomial Test
bootkm

Bootstrap Kaplan-Meier Estimates
ciapower

Power of Interaction Test for Exponential Survival
addMarginal

Add Marginal Observations
approxExtrap

Linear Extrapolation
biVar

Bivariate Summaries Computed Separately by a Series of Predictors
bpplot

Box-percentile plots
contents

Metadata for a Data Frame
cpower

Power of Cox/log-rank Two-Sample Test
combine.levels

combine.levels
areg

Additive Regression with Optimal Transformations on Both Sides using Canonical Variates
all.is.numeric

Check if All Elements in Character Vector are Numeric
cut2

Cut a Numeric Variable into Intervals
cnvrt.coords

Convert between the 5 different coordinate sytems on a graphical device
data.frame.create.modify.check

Tips for Creating, Modifying, and Checking Data Frames
combplotp

Combination Plot
describe

Concise Statistical Description of a Vector, Matrix, Data Frame, or Formula
csv.get

Read Comma-Separated Text Data Files
curveRep

Representative Curves
gbayes

Gaussian Bayesian Posterior and Predictive Distributions
completer

completer
gbayesSeqSim

gbayesSeqSim
bystats

Statistics by Categories
equalBins

Multicolumn Formating
escapeRegex

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

estSeqMarkovOrd
errbar

Plot Error Bars
consolidate

Element Merging
dataRep

Representativeness of Observations in a Data Set
format.df

Format a Data Frame or Matrix for LaTeX or HTML
html

Convert an S object to HTML
deff

Design Effect and Intra-cluster Correlation
capitalize

capitalize the first letter of a string
discrete

Discrete Vector tools
htmltabv

htmltabc
ecdfSteps

ecdfSteps
dotchart2

Enhanced Dot Chart
estSeqSim

estSeqSim
label

Label Attribute of an Object
dotchartpl

Enhanced Version of dotchart Function for plotly
dotchart3

Enhanced Version of dotchart Function
latestFile

latestFile
mhgr

Miscellaneous Functions for Epidemiology
event.convert

Event Conversion for Time-to-Event Data
mgp.axis

Draw Axes With Side-Specific mgp Parameters
format.pval

Format P Values
ebpcomp

ebpcomp
find.matches

Find Close Matches
minor.tick

Minor Tick Marks
movStats

movStats
event.chart

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

Produces event.history graph for survival data
ggplotlyr

ggplotlyr
extractlabs

extractlabs
hashCheck

hashCheck
mtitle

Margin Titles
hdquantile

Harrell-Davis Distribution-Free Quantile Estimator
hidingTOC

Moving and Hiding Table of Contents
plotCorrM

plotCorrM
plotCorrPrecision

Plot Precision of Estimate of Pearson Correlation Coefficient
hlabs

hlabs
hoeffd

Matrix of Hoeffding's D Statistics
list.tree

Pretty-print the Structure of a Data Object
getHdata

Download and Install Datasets for Hmisc, rms, and Statistical Modeling
latexDotchart

Enhanced Dot Chart for LaTeX Picture Environment with epic
first.word

First Word in a String or Expression
getZip

Open a Zip File From a URL
prnz

Print and Object with its Name
getabd

getabd
getRs

Interact with github rscripts Project
latexTabular

Convert a Data Frame or Matrix to a LaTeX Tabular
prselect

Selectively Print Lines of a Text Vector
fImport

fImport
mApply

Apply a Function to Rows of a Matrix or Vector
hist.data.frame

Histograms for Variables in a Data Frame
colorFacet

Miscellaneous ggplot2 and grid Helper Functions
histbackback

Back to Back Histograms
latex

Convert an S object to LaTeX, and Related Utilities
ggfreqScatter

Frequency Scatterplot
histboxp

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

Generate Multinomial Random Variables with Varying Probabilities
mChoice

Methods for Storing and Analyzing Multiple Choice Variables
knitrSet

knitr Setup and plotly Service Function
latexCheckOptions

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

Matrix of Correlations and P-values
makeNstr

creates a string that is a repeat of a substring
labcurve

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

runifChanged
na.delete

Row-wise Deletion na.action
hlab

hlab
impute

Generic Functions and Methods for Imputation
na.keep

Do-nothing na.action
mdb.get

Read Tables in a Microsoft Access Database
meltData

meltData
%nin%

Find Matching (or Non-Matching) Elements
print.char.list

prints a list of lists in a visually readable format.
na.detail.response

Detailed Response Variable Information
samplesize.bin

Sample Size for 2-sample Binomial
intMarkovOrd

intMarkovOrd
nobsY

Compute Number of Observations for Left Hand Side of Formula
nstr

Creates a string of arbitry length
simRegOrd

Simulate Power for Adjusted Ordinal Regression Two-Sample Test
num.intercepts

Extract number of intercepts
panel.bpplot

Box-Percentile Panel Function for Trellis
latexTherm

Create LaTeX Thermometers and Colored Needles
legendfunctions

Legend Creation Functions
partition

Patitions an object into different sets
print.char.matrix

Function to print a matrix with stacked cells
pstamp

Date/Time/Directory Stamp the Current Plot
popower

Power and Sample Size for Ordinal Response
qcrypt

qcrypt
rm.boot

Bootstrap Repeated Measurements Model
princmp

princmp
runParallel

runParallel
showPsfrag

Display image from psfrag LaTeX strings
simplifyDims

List Simplification
stata.get

Enhanced Importing of STATA Files
string.bounding.box

Determine Dimensions of Strings
multLines

Plot Multiple Lines
simMarkovOrd

simMarkovOrd
ordGroupBoot

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

pMedian
string.break.line

Break a String into Many Lines at Newlines
stringDims

String Dimentions
summary.formula

Summarize Data for Making Tables and Plots
rcspline.eval

Restricted Cubic Spline Design Matrix
nCoincident

nCoincident
pc1

First Principal Component
plotlyM

plotly Multiple
plsmo

Plot smoothed estimates
tabulr

Interface to Tabular Function
rcspline.restate

Re-state Restricted Cubic Spline Function
plot.princmp

plot.princmp
summaryM

Summarize Mixed Data Types vs. Groups
pairUpDiff

pairUpDiff
sys

Run Unix or Dos Depending on System
print.princmp

print.princmp
reShape

Reshape Matrices and Serial Data
testCharDateTime

testCharDateTime
smean.sd

Compute Summary Statistics on a Vector
t.test.cluster

t-test for Clustered Data
vlab

vlab
valueTags

Store Descriptive Information About an Object
rcspline.plot

Plot Restricted Cubic Spline Function
qrxcenter

qrxcenter
r2describe

r2describe
sasxport.get

Enhanced Importing of SAS Transport Files using read.xport
wtd.stats

Weighted Statistical Estimates
solvet

solve Function with tol argument
varclus

Variable Clustering
ynbind

Combine Variables in a Matrix
printL

printL
redun

Redundancy Analysis
scat1d

One-Dimensional Scatter Diagram, Spike Histogram, or Density
rcorr.cens

Rank Correlation for Censored Data
rcorrp.cens

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

Special Version of legend for R
seqFreq

seqFreq
show.pch

Display Colors, Plotting Symbols, and Symbol Numeric Equivalents
spower

Simulate Power of 2-Sample Test for Survival under Complex Conditions
spss.get

Enhanced Importing of SPSS Files
soprobMarkovOrdm

soprobMarkovOrdm
spikecomp

spikecomp
tex

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

Embed a new plot within an existing plot
src

Source a File from the Current Working Directory
score.binary

Score a Series of Binary Variables
summarize

Summarize Scalars or Matrices by Cross-Classification
transace

Additive Regression and Transformations using ace or avas
sedit

Character String Editing and Miscellaneous Character Handling Functions
xy.group

Mean x vs. function of y in groups of x
trunc.POSIXt

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

Get Number of Days in Year or Month
stat_plsmo

Add a lowess smoother without counfidence bands.
summaryS

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

Units Attribute of a Vector
upData

Update a Data Frame or Cleanup a Data Frame after Importing
symbol.freq

Graphic Representation of a Frequency Table
upFirst

Change First Letters to Upper Case
xYplot

xyplot and dotplot with Matrix Variables to Plot Error Bars and Bands
xtfrm.labelled

Auxiliary Function Method for Sorting and Ranking
somers2

Somers' Dxy Rank Correlation
soprobMarkovOrd

soprobMarkovOrd
summaryP

Multi-way Summary of Proportions
summaryRc

Graphical Summarization of Continuous Variables Against a Response
translate

Translate Vector or Matrix of Text Strings
transcan

Transformations/Imputations using Canonical Variates