[R] digits in matrix

Knut Krueger
Fri, 30 Jan 2015 13:17:57 -0000

Am 30.01.2015 um 12:51 schrieb Duncan Murdoch:

> You are mixing up formatting with storage.  Floating point numbers will
> be displayed without decimals if they are close enough to whole numbers.
>
> Duncan Murdoch
>

Ok, I am talking from display

data = matrix(c(1:16),nrow=4,ncol=4) #create matrix
data[4,] = data[4,]/3
data[,4] = data[,4]/3
#why is it displayed without decimals here:
data[1:3,1:3]
#and why is data[1:3,1:3] diplayed with 2 decimals here
data

and what could be the solution to display data[1:3,1:3] part when data
is used  without decimals, if there are no

Kind regards Knut