Questions tagged [hmisc]

Hmisc is an R package of miscellaneous utility functions.

Hmisc is an package of miscellaneous functions by Frank Harrell. It contains many functions useful for , ting, utility operations, functions for computing and power, importing datasets, imputing , advanced table making, , manipulation, conversion of R objects to code, and recoding variables.

Repositories

Other resources

Related tags

216 questions
39
votes
4 answers

R: Assign variable labels of data frame columns

I am struggling with variable labels of data.frame columns. Say I have the following data frame (part of much larger data frame): data <- data.frame(age = c(21, 30, 25, 41, 29, 33), sex = factor(c(1, 2, 1, 2, 1, 2), labels = c("Female",…
panman
  • 1,179
  • 1
  • 13
  • 33
17
votes
2 answers

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called 'stringi'

When I use library(Hmisc) I get the following error Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called 'stringi' Error: package 'ggplot2' could not be loaded As well, if I use…
Marta
  • 171
  • 1
  • 1
  • 3
15
votes
3 answers

divide a range of values in bins of equal length: cut vs cut2

I'm using the cut function to split my data in equal bins, it does the job but I'm not happy with the way it returns the values. What I need is the center of the bin not the upper and lower ends. I've also tried to use cut2{Hmisc}, this gives me the…
matteo
  • 645
  • 3
  • 10
  • 18
14
votes
1 answer

Evaluation Error when tidyverse is loaded after Hmisc

I am using r 3.3.3, dplyr 0.7.4, and Hmisc 4.1-1. I noticed that the order I load packages effects whether or not a dplyr::summaries function wold work or not. I understand that loading packages in a different order would mask certain functions but…
Mike
  • 3,797
  • 1
  • 11
  • 30
13
votes
3 answers

How to assign "cut" range midpoints in R?

I am using cut to divide my data into bins, which gives the resulting bin as something like (x1,x2]. Can anyone tell me how I might make a new column that expresses these bins as the midpoint of the bin? For example, with the following…
Thomas
  • 2,484
  • 8
  • 30
  • 49
9
votes
3 answers

"Hmisc" package or namespace failed to load - no package called 'latticeExtra'

I'm having trouble loading and running the Hmisc package. When installing it, I get the following error; library(Hmisc) Loading required package: lattice Loading required package: survival Loading required package: Formula Loading required package:…
Mick
  • 91
  • 1
  • 1
  • 3
8
votes
1 answer

Sample size and power calculation in r as viable alternative to proc power in SAS?

So I am trying to see how close the sample size calculations (for two sample independent proportions with unequal samples sizes) are between proc power in SAS and some sample size functions in r. I am using the data found here at a UCLA website.…
user27008
  • 600
  • 3
  • 15
  • 24
7
votes
1 answer

ggplot2 stat_summary mean_sdl not the same as mean +/- sd

I am unsure as to why the error bars generated by the mean_sdl function (from Hmisc) in ggplot2 are significantly broader than the error bars generated manually and plotting mean + sd and mean - sd. My…
biomiha
  • 1,358
  • 2
  • 12
  • 25
7
votes
3 answers

How to do a crosstab with two categorical variables but populate it with the mean of the third variable

library(ggplot2) data(diamonds) str(diamonds) ## 'data.frame': 53940 obs. of 10 variables: ## $ carat : num 0.23 0.21 0.23 0.29 0.31 0.24 0.24 0.26 0.22 0.23 ... ## $ cut : Ord.factor w/ 5 levels "Fair"<"Good"<..: 5 4 2 4 2 3 3 3 1 3…
Ajay Ohri
  • 3,382
  • 3
  • 30
  • 60
7
votes
2 answers

Hmisc separate column headings with rowname = NULL

I'm trying to have column headings and the horizontal line underneath the headings separated by the groups. When I do the following it works, library(Hmisc) data(mtcars) latex(mtcars, file ='', cgroup = c("Group 1", "Group 2"), n.cgroup = c(5,…
Jake Russ
  • 683
  • 1
  • 9
  • 19
7
votes
2 answers

Row Percentages in crosstable generated from summary() from the Hmisc package

I have been trying to learn to use the summary()-function from the Hmisc-package to generate crosstables that include chisquared tests. With help from this board I'm almost there. I just can't figure out how to obtain row-percentages instead of…
Rene Bern
  • 545
  • 3
  • 10
  • 18
6
votes
1 answer

Tables created from latex() from the Hmisc-package are horisontally left-aligned instead of being centered horisontally in the pdf-document

Using R-studio and Knitr to create a pdf I am unable to get the tables centered horisontally. As seen from the example below, it works fine using xtable(), but the latex()-tabels are all left-aligned. As I understand the Hmisc-documentation, tables…
Rasmus Larsen
  • 5,721
  • 8
  • 47
  • 79
6
votes
3 answers

Hmisc::latex not printing caption w/ tabular object

First I will tell you what I'm attempting to do big picture in case I'm going about it wrong. I have a nested table that I'd like to out put as a LaTeX table within RStudio using knitr. I am fine until I try to add a caption. I tried the example…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
5
votes
1 answer

data.table: lapply a function with multicolumn output

I'm using a function smean.cl.normal from Hmisc package that returns a vector with 3 values: the mean and the lower and upper CI. When I use it on a data.table with 2 groups, I obtain 2 columns and 6 rows. Is there a way to obtain the result with…
mattek
  • 903
  • 1
  • 6
  • 18
5
votes
3 answers

R - describe() output to a data frame

I want to create a data frame using describe() function. Dataset under consideration is iris. The data frame should look like this: Variable n missing unique Info Mean 0.05 0.1 0.25 0.5 0.75 0.9 0.95 Sepal.Length 150 …
skumar
  • 353
  • 2
  • 4
  • 12
1
2 3
14 15