I would like to custom format the numeric columns in my table. I would like to have the p-values in scientific format, and the other numeric columns with 0 or 2 decimals. How can I do this? I have tried
output$addtable <- renderTable({ ...} , digits = -2)
but that converts all numeric columns into scientific format.
output$addtable <- renderTable({
dataset <- datasetInput()
d=dataset[which(dataset$gene==input$textgene),]
names(d)=c("Gene","P","CmafUsed","NsnpsUsed","MinP","MinGene","Ratio")
if(dim(d)[1]==0) {'No entry found'} else return(d)
})
What I am looking for is to have:
Gene P CmafUsed NsnpsUsed MinP MinGene Ratio
GENE1 1.50E-05 0.20 12 4.62E-05 GENE2 1.11
Since you mentioned scientific, this comes to mind:
df = data.frame(P = 1e-6, Rest = 1e-6)
df$P <- format(df$P, scientific = FALSE)
df$Rest <- format(df$Rest, scientific = TRUE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With