Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201943

Descriptives Tabel with arsenal tableby - operator as.numeric - change labels

$
0
0

I'd like to generate a descriptive Table using arsenal. Unfortunately some of the data is a factor.

Here is the df

df<-data.frame(group=rep(c("A","B","c"),3), value1=c(1:9), value2=as.character(floor(runif(9,2000,2010))), dummy=rep(c("Yes","No","No")))

Value2 is as.character intentionally, to show the later problem and for later analysis I'd like to keep it as is.

The standard table would be generated like this:

desTab<-tableby(~value1 +as.numeric(value2) + dummy, data= df)
summary(desTab, labelTranslations = labs1, digits= 0)

Leading to an output as follows in Markdown: enter image description here

I'd like to change the labels so the table does not show the "as.numeric()" anymore.

labs1<-list(
  value1 = "Value",
  as.numeric(value2) = "Year",
  dummy = "Dummy"
)

However, this does not solve the labs for "as.numeric".

I'd like the labeling to be like so: enter image description here

Thanks for any help and advice!


Viewing all articles
Browse latest Browse all 201943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>