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 (
c(word1,word2,word3,word4,word5,word6)
nrow=2,,
ncol=3
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).
- Note the double commas after
nrow=2
, there should be only one there. and one comma afterncol=3
- 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 toword1
,word2
,... elsewhere.