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
2
votes
0 answers

hmisc::wtd.quantile(..., weights = ...) error when all values are NAs and/or all weights are 0s or NAs

Context: I compute summary statistics by group, I need to use hmisc::wtd.quantile() function because I have frequency of each value. Problem: sometimes, all values are NAs and/or all weights are 0s or NAs. Then, wtd.quantile() fails if weights = ...…
Paul
  • 2,850
  • 1
  • 12
  • 37
2
votes
1 answer

Vectorizing over the output of Hmisc::partition.matrix

I have been trying to simulate a binomial process that occurs over several weeks, for different pool sizes. I have 7 different pool sizes, and probabilities of the positive outcome for each week. I have simulated a Bernoulli process, which gives me…
KVemuri
  • 194
  • 1
  • 16
2
votes
1 answer

How to solve y must be binary error on Hmisc?

I am trying to extract the Concordance index of a glmer model by using somers2 of the Hmisc package in R. probs <- binomial()$linkinv(fitted(my.glmer.model)) somers2(probs, as.numeric(my.df$my.col)-1) By I get this error: Error in somers2(probs,…
Audrey
  • 33
  • 4
2
votes
3 answers

How to install "Hmisc" in R

install.packages("Hmisc") Warning in install.packages : unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES' Installing package into …
ATUL MEHRA
  • 43
  • 1
  • 1
  • 5
2
votes
1 answer

How extract several imputed values from several variables using mice or another package in R into a single dataset?

From the multiple imputation output (e.g., object of class mids for mice) I want to extract several imputed values for some of the imputed variables into a single dataset that also includes original data with the missing values. Here are sample…
Krantz
  • 1,424
  • 1
  • 12
  • 31
2
votes
1 answer

Getting the labels of the column names (hmisc)

I have used the Hmisc library to attach labels to column names, which you could do as follows. example library(Hmisc) label(mydata$myvar) <- "Variable label for variable myvar" Results: It would be possible to set the labels for an entire df…
Tom
  • 2,173
  • 1
  • 17
  • 44
2
votes
6 answers

Creating a loop to add labels to colums: library(Hmisc)

I have a dataset which looks something like this: Year Country Matchcode P H 1 2000 France 0001 1213 1872 2 2001 France 0002 1234 2345 3 2000 UK 0003 1726 …
Tom
  • 2,173
  • 1
  • 17
  • 44
2
votes
2 answers

Can not install the CRAN packages "viridis", "Hmisc" on IBM Watson Studio R Environment Notebooks

I am trying to install the CRAN Hmisc package in an R Environment Notebook on IBM Watson Studio. But it repeatedly fails with the following Error: install.packages('Hmisc') also installing the dependencies ‘checkmate’, ‘rstudioapi’, ‘Formula’,…
Sumit Goyal
  • 575
  • 3
  • 16
2
votes
1 answer

Error in loading package SASxport: object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'

I'm trying to read data in the XPT format into R (the format can be found for example in the NHANES data). I found two functions doing…
Qaswed
  • 3,649
  • 7
  • 27
  • 47
2
votes
1 answer

Set the number of digits in describe() function of Hmisc package

I try to set the number of digits when exporting in latex the result of describe() function. MWE: require("Hmisc") dat <- rnorm(1000,mean = 0, sd = 1) latex(describe(dat, digits=2)) produces the following output: The digits argument does not seem…
2
votes
1 answer

Caption not appearing for LaTeX table when knitting using Hmisc LaTeX Function

I am trying to create a LaTeX table using the table and Hmisc packages however, I am having trouble getting the caption to appear. Here is a reproducible example: ```{r, results = "asis"} # data: dow <- sample(1:7, 100, replace=TRUE) purp <-…
TDP
  • 335
  • 1
  • 3
  • 9
2
votes
1 answer

Selecting direction of multiple error bars in a line plot

Using ggplot2, how can we selectively choose the direction of error bars? I have a 4-line plot whose error bars overlap and I would like to manually choose which ones should appear only positive or negative SE or SDs. Here is what I have so far. I…
AJMA
  • 1,134
  • 2
  • 13
  • 28
2
votes
2 answers

Hmisc latex() saves file but R keeps running

Take this sample data frame df <- "A B C 1 1 2 3 2 4 5 6 3 7 8 9" df1 <- read.table(textConnection(df), header=TRUE) I want to save it as a table on a .tex file. The function require(Hmisc) latex(df1,title="TeX/df1prova") saves the file, but…
simone
  • 577
  • 1
  • 7
  • 15
2
votes
2 answers

Transpose a table, exported from R to Latex with latex() from Hmisc package

I am trying to write output from R to Latex. I expect to get nicely formatted table from R: When I use latex() function from Hmisc package, I get this: How can I transpose the table, making it 2x6 instead of 6x2? I know that there must exist some…
Moysey Abramowitz
  • 352
  • 1
  • 7
  • 19
2
votes
0 answers

Summary() not showing some level of data in R

Just came across HMISC summary() which looks like a quick tool for preparing shell tables for descriptive stats for my manuscripts. I have this code : summary.stats<-summary(lead_ind ~ age + gender + Region, npct="both",…
user1916067
  • 127
  • 1
  • 11