I finally got the solution. Looking into the function code by doing open ftt (matlab) we can see:
% FFT(X,N) is the N-point FFT, padded with zeros if X has less
% than N points and truncated if it has more.
% FFT(X,,DIM) or FFT(X,N,DIM) applies the FFT operation across the
% dimension DIM.
Therefore, if X has less than n points, the vectors ...
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 ...