Hi R Community,

I would like to make a table in RMarkdown, however, the placement of the rows and colums are not as I wish.

I will use the Iris R data set as an example. When running:

knitr::kable(iris, "pipe")

I get:

However, I wish to have the different spcies as columns and then a row of mean(sepal.Length), one of mean(Sepal.Width), one of mean(Petal.lenth) and a last of mean(Petal.Width). Also, I would like an extra column containing the sum of all species and which for all rows have the mean of the whole data set and not just for the specific species.

So far I have not found out how to solve this problem.

Thank you in advance

Best,

Charlie