From a table like this:
df <-data.frame(c("72","72","69","70","57","77","74","70","74","78"))
colnames(df) <-c("edad")
df$edad<-as.numeric(df$edad)
I have calculated the percentage of each group
table1::table1(~ .,
data = df,
render.categorical="FREQ (PCTnoNA%)",
render.missing=NULL)
getting the mean and median (sometimes to two decimal places and sometimes to one decimal place)
Overall (N=10)
edad
Mean (SD) 71.3 (5.83)
Median [Min, Max] 72.0 [57.0, 78.0]
I would like to know how to obtain the result with the number of decimal places that I want (with only one decimal) and obtain only the mean instead of the median.
table1()
allows you to define the function to "draw" the values, in this case the continuous ones through the parameter:render.continuous
, then you can rewrite the default function incorporating what you are looking for: