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
3
votes
1 answer

R - Getting Imputed Missing Values back into dataframe

I'm using aregImpute to impute missing values on a R dataframe (bn_df). The code is this: library(Hmisc) impute_arg <- aregImpute(~ TI_Perc + AS_Perc + CD_Perc + CA_Perc + FP_Perc, data = bn_df,…
BrunoPT
  • 37
  • 1
  • 5
3
votes
1 answer

How to add imputed data (w/ aregImpute) to a data frame?

My question is how do I go about adding the imputed data to the quakes.missing data frame? I've created a reproducible example below. library(Hmisc) library(missForest) #load packages data("quakes") quakes quakes.missing <- prodNA(quakes, noNA =…
2602
  • 332
  • 3
  • 18
3
votes
1 answer

how to use variable label instead of variable name in r plots?

My dataframe (df) with column names "8A_1" and 8A_2" is: 8A_1 8A_2 1 2 2 2 4 3 3 4 4 4 4 3 5 4 3 6 1 4 7 2 4 8 2 4 9 4 3 10 4 4 The variable labels are (which are added to the…
Amirul Islam
  • 407
  • 1
  • 6
  • 15
3
votes
0 answers

Unzip password protected archive and read the containing SPSS file into R

I have a password protected zip archive containing one SPSS system data file (*.sav). And I want to unpack it and read its content into R. From what I googled, Hmisc::getZip seems to be the best bet. And I've tried some different approaches. First…
habana
  • 317
  • 1
  • 11
3
votes
1 answer

Rotate column headers on Hmisc generated table

I need to rotate the headers from a table 90 degrees using the Hmisc package. I tried changing the 'colnamesTexCmd' command but nothing changes on the column headers. Below is a reproducible example of my problem --- title: "" author: "" date:…
user3357059
  • 1,122
  • 1
  • 15
  • 30
3
votes
2 answers

Obtaining nice cuts in Hmisc with cut2 (without the [ ) signs )

I'm currently trying to neatly cut data with use of the Hmisc package, as in the example below: dummy <- data.frame(important_variable=seq(1:1000)) require(Hmisc) dummy$cuts <- cut2(dummy$important_variable, g = 4) The produced cuts are correct…
Konrad
  • 17,740
  • 16
  • 106
  • 167
3
votes
1 answer

Correlation matrix by group

This is my data frame df <- structure(list(g1 = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L), .Label = c("A", "C"), class = "factor"), g2 = structure(c(1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 2L), .Label = c("a", "b"), class = "factor"), v1 =…
erc
  • 10,113
  • 11
  • 57
  • 88
3
votes
1 answer

R markdown v2 and Hmisc tables

How can I take the output from summary in Hmisc and have it rendered in knitr with the correct formatting and preferably transferred to word as a table for my collaborators? The following chunk produces a table but the formatting is off (all the…
Misha
  • 3,114
  • 8
  • 39
  • 60
3
votes
1 answer

How to force Hmisc::describe to display frequencies?

describe(letters[1:19]) outputs a table of frequencies but describe(letters[1:20]) does not. I tried setting listunique=10^7 and listnchar=0 but that didn't help. http://cran.r-project.org/web/packages/Hmisc/Hmisc.pdf
kevinykuo
  • 4,600
  • 5
  • 23
  • 31
3
votes
2 answers

Hmisc tilde rowname

I am trying to group row names in a R data frame for typesetting with the Hmisc latex() function. Problem is that latex() adds two tilde characters before each row name, and these show up in my document. How can I either remove these characters or…
clay
  • 51
  • 3
3
votes
1 answer

Create table 1 in R

Does anyone know how to create a typical table 1 in clinical papers using R? To be more specific, I need to report mean/SD for continuous variables and count/percentages for categorical variables for the whole population and also for each group…
2
votes
1 answer

Removing excess classes for a whole dataframe

I have data as follows, and a problem I regretfully don't seem to be able to reproduce: dat <- structure(c(1, NA_real_), format.stata = "%8.0g", labels = c(female = 1, male = 2), class = c("haven_labelled", "vctrs_vctr", "double" )) dat <-…
Tom
  • 2,173
  • 1
  • 17
  • 44
2
votes
3 answers

Avoid assigning label to dataframe columns one by one for large number of columns

This is a dataframe I want to label. The labels are going to come from a column in another dataframe. a b c 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 variable label 1 a label1 2 b label2 3 c label3 These are my tries with either…
Mathica
  • 1,241
  • 1
  • 5
  • 17
2
votes
1 answer

Cross sectional correlation across grouped data and summarized in latex table

I have a time-series panel dataset which is structured in the following way: df <- data.frame( year = c(2012L, 2013L, 2014L, 2012L, 2013L, 2014L, 2015L), id = c(1L, 1L, 1L, 2L, 2L, 2L, 2L), col1 = c(11L, 13L, 13L, 16L, 15L, 15L, 16L), col2…
Erwin Rhine
  • 303
  • 2
  • 11
2
votes
2 answers

Can I pipe into describe in R?

Describe from Hmisc is one of my favorite functions. It gives a great looking summary for a dataset. I'd like to be able to filter a dataset with dplyr and then pass a single column to describe(). Something like this mtcars %>% filter(cyl > 5) %>%…
Cauder
  • 2,157
  • 4
  • 30
  • 69
1 2
3
14 15