0

I have a matrix in r (or dataframe) and would like to display the data but without the column names.

This because the data contained will be part of a markdown to word and therefore only data that I have within the table is relevant.

The final objective is to bring data contained that was generated with an r-script into a markdown document.

Table example:

df<-matrix(c("Name: John Doe", "Country: USA", "State: IL","Role: Consultant","Company: Microsoft","University: NYU"),ncol=2,byrow=TRUE)

Any ideas on how to display the data but not the column/row titles

aynber
  • 22,380
  • 8
  • 50
  • 63
Jo Costa
  • 421
  • 1
  • 6
  • 17
  • I'm not entirely sure what the end-goal is, but if you just want to save it without column names you can just do `write.table(df, "path", col.names = F, ...)` – ljwharbers Sep 14 '20 at 15:43
  • Thank you, not quite, as I want to use this into Markdown rather than just extracting into a file. – Jo Costa Sep 15 '20 at 08:11

1 Answers1

1

Try cat:

cat(df, sep = "\n")

Output:

Name: John Doe
State: IL
Company: Microsoft
Country: USA
Role: Consultant
University: NYU
salexir
  • 46
  • 1