*I would like to plot some semi-periodic signals as a function of the phase
expressed as a value in [0,2PI]*
*The problem is that the phase data is reported as the residual of the
division by 2PI.*
*For instance if the phase is 10.359 rd  then:*
*15.359 / 6.283185  = 2*6.283185 + 2.79263*
*then only the residual 2.79263 is stored. *
*In order to plot a number of consecutive cycles I have to add the correct
multiple of 2PI  to each phase valu.*
*The end/beginning of  anew cycle is marked in another field, say
phase-mark, containing the letter "Z".*
*My goal is to write a small routine that does that for each signal file.*
*If I had to do that in C language I'd write something like:*
**
*num-cycles = 0;
for (i=0,i<num-records; i++) {*
*   if ( my.data.frame$phase_mark[i] =="Z" )  {*
*        my.data.frame$phase[i]  += num-cycles*2PI;*
*        num-cycles++;*
*   }*
*}*

*Questions*:

*1. How can I write a small routine like the one above to operate on certain
columns of an entire data.frame ?*
*2. How can I write a parametric R script (like a shell script in Linux)
that reads a CSV file into a new R data.frame ? The commands I now issue
manually are as follows:*
**
*read.csv("file-name",header=T,skip=9)*
*file-name$PatientID = paste(rep("file-name",length(file-name[,1])))*
*names(file-names)= c("Amplitude","Phase", ....)*

Thank you so much.
Maura





-- 
Maura E.M

	[[alternative HTML version deleted]]

