[R] Fourier descriptors created in a loop

aledanda danda.galli at gmail.com
Wed Jun 6 11:13:41 CEST 2012


Hi David,

Thank you for your reply.

/Somehow I'm guessing that this will involve load an unnamed package.  
Yep:
 > ?create.fourier.descriptor
No documentation for ‘create.fourier.descriptor’ in specified packages  
and libraries:
you could try ‘??create.fourier.descriptor’/

So I indeed forgot to mention in my post that my script starts with 

*library('FourierDescriptors')*


/> *count <- seq(1, 7, 0.06)
>
> for (i in 1:count){

I was also  wondering what would happen when you passed a vector to  
the ":" operator. A warning at the very least. What was the point of  
this outer loop?/

I need the outer loop for changing the amplitude of my shapes at every
iteration.
I specified the amplitudes I want in 

count <- seq(1, 7, 0.06).

This outer loop actually works (when I correct the  "for (i in 1:count){"
into  "for (i in count){.")
It generates in fact all the shapes I want. The problem is with the inner
loop, it doesn't seem to save any png picture in my directory. The error is:

*Error in switch(units, `in` = res, cm = res/2.54, mm = res/25.4, px = 1) * 
: 
  non-numeric argument to binary operator*

I report my all script here again:

library('FourierDescriptors')

count <- seq(1, 7, 1)
# Controlled shapes
for (i in count){
  for (s in 1:length(count)){
    png("~/Desktop/EMAS/FD_stimuli/s1_",s,".png")
    plot(create.fourier.descriptor(amplitude = c(0, i)));
    dev.off()
  }
}

Thank you for your help
Best

Ale


--
View this message in context: http://r.789695.n4.nabble.com/Fourier-descriptors-created-in-a-loop-tp4632414p4632505.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list