# TMTOWTDI

### Hong Zheng / 2017-08-30

There’s more than one way to do it. (TMTOWTDI)

Although this is a perl motto, it applies to R, Python, bash, whatever language you name it.

The commands I put together here are very basic data manipulating techniques. I use Linux/Bash and R a lot, but often I forget the specific syntax and have to look it up somewhere. Here is the collection of them:

### Calculate the sum of one column 计算一列之和

• R
In R it is pretty simple. The sum function does it.
• Bash
Suppose the column to be calculated in the 1st column

### Transpose (switch rows and columns) 行列转置

• R
Simple. Use t
• Bash

• Bash

• Bash