[R] R fft on 2D matrix

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Apr 1 18:46:55 CEST 2004


Anne Gosset wrote:

> Hi,
> 
> I am a brand new user of R and I have a really stupid problem: I am having troubles applying fft on 2D matrices.
> I import a data file of 256*256 elements with read.table (it is actually a grey scale image, the corresponding data file being generated with Matlab), and I find that the fft can be applied on one single column of data, but not on one row. 
> (Error message:
> Error in fft(z, inverse) : non-numeric argument
> )

Be careful: read.table() creates a data.frame, but not a matrix.



> Is it the format of the matrix which causes that trouble? 

Well, the trouble is that it is a data.frame.  Try as.matrix(X), if the 
contents was numeric data.


 > (although I checked with the editor that the matrix was well imported)
> Besides this, it is not possible to plot one single row of data (strange plot with the names of variables appearing).

Again, you got a data.frame with 1 row, but 256 variables. Hence the 
plot is a scatterplot matrix, with the one observation plotted.

Uwe Ligges


> Thanks in advance for your help,
> 
> Anne Gosset
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list