I want to create a matrix with rows and columns

Be sure to post your question as a reprex (FAQ: What's a reproducible example (`reprex`) and how do I do one?).

When you do, you'll note the code were you setup the matrix produces an error message:

MyMatrix = 
  matrix (
    byrow= TRUE)
#> Error: <text>:5:5: unexpected symbol
#> 4:     c(word1,word2,word3,word4,word5,word6)
#> 5:     nrow
#>        ^

Created on 2018-04-23 by the reprex package (v0.2.0).

  1. Note the double commas after nrow=2, there should be only one there. and one comma after ncol=3
  2. Also character-strings in R need to be surrounded by quotation marks. So your vector should be something like c("word1","word2","word3","word4","word5","word6"), unless you assigned a string to word1, word2,... elsewhere.