How to use data.matrix in R



I have created a data frame and I want to convert it into a matrix and I can only convert the first column but I can not convert the logical column as true and false instead of it I am getting the 1 and 0 which I know it is correct but I want True and False ?
foo bar
[1,] 1 1
[2,] 2 1
[3,] 3 0
[4,] 4 0


@sid100158 Please remember that a matrix object can contain only objects of the same atomic type: it’s a generalisation of a vector; or to put in another, a vector is a special case of a matrix.