How to sum all the elements of a matrix

Hi guys I am trying to add all the elements of a matrix in one step 

The matrix is as follows:

ROWID X Y Z
A 5 1 3
B 3 3 3
C 1 2 4
D 3 3 1
R 4 1 0

I wonder if I can use some scripting nodes because the number of colums may vary and I think is better to treat the matrix as a dataframe.

I used the node R Snippet but I got an error:

knime.in<-sum(knime.in)
knime.out <- knime.in

ERROR R Snippet            0:152      Execute failed: CODING PROBLEM    importBufferedDataTable(): Supporting only 'data.frame', 'matrix' and 'list' for type of "knime.out" (was 'numeric').

Thank you

 

It is usually enough to wrap the matrix in data.frame. Like:

knime.out <- data.frame(knime.in)


 

Thank you it worked fine

Best Regards