Hello R gurus, I am having difficulties running a chunk of code that I otherwise thought was correct..> if (lower < max(length(IC_peaks),length(IC_valleys))) {+ valley_index <- IC_valleys[lower+1] + for (i in seq(peak_index,valley_index-1)) { + IC_peaks_and_valleys <- c(IC_peaks_and_valleys, "v") + } + } Error in from:to : NA/NaN argument I can not pin point the issue and if you have any suggestions I would greatly appreciate them. If more code is needed to figure out the problem, I will post it right away. Thank you all. -- View this message in context: http://n4.nabble.com/Error-in-from-to-NA-NaN-argument-tp2017930p2017930.html Sent from the R help mailing list archive at Nabble.com.
On Apr 20, 2010, at 3:54 PM, cobbler_squad wrote:> > Hello R gurus, > > I am having difficulties running a chunk of code that I otherwise > thought > was correct.. > >> if (lower < max(length(IC_peaks),length(IC_valleys))) { > + valley_index <- IC_valleys[lower+1] > + for (i in seq(peak_index,valley_index-1)) { > + IC_peaks_and_valleys <- c(IC_peaks_and_valleys, "v") > + } > + } > Error in from:to : NA/NaN argumentPerhaps an error in you seq() call which has from and to arguments. What do you get with this: str(peak_index) str(valley_index)> > I can not pin point the issue and if you have any suggestions I would > greatly appreciate them. If more code is needed to figure out the > problem, I > will post it right away. > > Thank you all. >-- David Winsemius, MD West Hartford, CT
Hi, The problem, I think, comes from seq(peak_index,valley_index-1) Since I don't know what is peak_index and valley_index, it is difficult to further help you. Ivan Le 20-Apr-10 21:54, cobbler_squad a ?crit :> Hello R gurus, > > I am having difficulties running a chunk of code that I otherwise thought > was correct.. > > >> if (lower< max(length(IC_peaks),length(IC_valleys))) { >> > + valley_index<- IC_valleys[lower+1] > + for (i in seq(peak_index,valley_index-1)) { > + IC_peaks_and_valleys<- c(IC_peaks_and_valleys, "v") > + } > + } > Error in from:to : NA/NaN argument > > I can not pin point the issue and if you have any suggestions I would > greatly appreciate them. If more code is needed to figure out the problem, I > will post it right away. > > Thank you all. > > >