In this example I rbind two data.frames, and the result is that all values have two decimal numbers. However, I want to have no decimal numbers in row 1 and 2.
one <- data.frame(matrix(c(1,2,3,4), ncol=2)); one
two <- data.frame(matrix(c(1.63,8.88,9.17,2.31), ncol=2)); two
rbind(one, two)
You can use
sprintfbut this will convert your variables into characters (rather than numeric), i.e.which gives,
However the structure is,
If you convert it to numeric, you will again get those decimals, i.e.