I would like to fix my non decimal values as integers but i don't achieve it.
I try this way : round(x, digits=0) but still appears like a decimal number due to my last value (a decimal one).
dataframe_test <- data.frame( Information = c( "Number 1", # integer "Number 2", # integer "Number 3", # integer "Number 4 "), # decimal Total = c(round(11, digits=0), round(21, digits=0), round(13, digits=0), round(11/21, digits=2) ) )
1 Number 1 11.00
2 Number 2 21.00
3 Number 3 13.00
4 Number 4 0.52
But still a wrong display, 11 appears 11.00.
I have the same issue if, for example, one element of the column is a character, then all the elements (numbers) become characters/factors...
Is there a trick other than convert numbers in strings character (i use a shiny app, and extract these dataframes in .xls files, so i would like to have numbers when it's.. numbers).