I'm running the following script:
cause = c(1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2);
time = c(1, 1, 2, 3, 3, 2, 2, 1, 1, 2, 2);
table(cause, time)
And I get the following:
time
cause 1 2 3
1 2 2 2
2 2 3 0
What I want is this:
time
cause 1 2 3
Maltreat 2 2 2
Non-Maltr 2 3 0
So, my question is: how do you rename the rows of a table in R?
In the same vein, how would you rename the columns of that table?