Matlab and R functions for fft(): N-point FFT and dimension issue
R allows you to loop over rows or columns through the use of the apply family of functions. Note that apply is not necessarily faster than looping but more in line with the functional programming nature of R. There are other apply functions such as lapply, vapply, sapply etc but for your purposes, apply should suffice.  Also, note that you may have to transpose the result using t(result). 1 means go over rows and 2 means go over columns. So, if X is the matrix, 

apply(X, 1, fft) does the fft of the rows.

apply(X, 2, fft) does the fft of the columns.


Note that the use of .row or .col is my convention. I could have used x, y , or z because that's just a dummy variable from apply's point of view.

Also, you can type ? apply in R in order to obtain the help for apply. Sometimes they can be kind of obscure but atleast they tell you what arguments are available.