[R] hide row and column-names in cat()

Tim Haering gnireaht at googlemail.com
Wed Aug 24 13:46:45 CEST 2011


Dear list,

to prepare data as input for a stand-alone groundwater model I use the
cat() function to print data.
I want to print a table with print() or cat() but without the row- and
column-names. Is this possible?

Here a small example

my.df <- rbind(c("Nr","FraSand","FraSilt","FraClay","pH"), c("",
"(kg.kg-1)","(kg.kg-1)", "(kg.kg-1)", "(-)"), c(1, 19, 60, 21, 7.1),
c(2, 35, 53, 11, 7.7))
print(my.df, quote=FALSE)
     [,1] [,2]      [,3]      [,4]      [,5]
[1,] Nr   FraSand   FraSilt   FraClay   pH
[2,]      (kg.kg-1) (kg.kg-1) (kg.kg-1) (-)
[3,] 1    19        60        21        7.1
[4,] 2    35        53        11        7.7

What I want to have is this:

 Nr   FraSand   FraSilt   FraClay   pH
      (kg.kg-1) (kg.kg-1) (kg.kg-1) (-)
 1    19        60        21        7.1
 2    35        53        11        7.7

Thank you.
TIM



More information about the R-help mailing list