I have 316 files. Each file represents a patient's breathing track
(respiratory signal recorded for a variable number of cycles). All files
have the same are made up of a header followed by a variable number of
records.
Each record contains 7 comma separated fields.
The patient ID is recorder in the header which is stripped off when reading
the file into a R data.frame.
Since I need to keep this piece of information, I need to add the 8th column
to a patient's data.frame. All elements of such a column store the patient's
ID.
The problem is trivial. I guess it can be done in a matter of a few seconds.
But I (a R novice) could not find an automatic or fast way to do that.
I started up editing the patient's data.frame and figured out I can only
copy and past 1 cell at a time ... but I had 4991 cells so  ... In addition,
I could not find a way to close the editing session while preserving the
changes in the data.frame.
So I generated a vector with 4991 elements, all recording the same
patient-ID call is patient_ID.
Then I used  *cbind(patient.data.frame, patient_ID)*
to generate a new.patient.data.frame made up of 8 columns, the last added
one recording the patient's ID.

I have no doubt R experienced users would accomplish the same task in a
couple of strokes .... HOW ????

Another question is: how can multiple cells copy&past be performed with R
editor ?
And how shall I instruct R to save my changes when I close the editing
session ?

Thank you very much,
-- 
Maura E.M

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to