How do you indicate which fields are present in a record with less than the full number? Via known delimiters for all fields? Via the order of values (fields are filled in order and only the last fields in a record can therefore be missing)?
If the former, see the "sep" parameter in read.table() and friends. If the latter, one way is to open the file as a connection and use readLines()(you would check how many values were present and fill in the NA's as needed).There may be better ways, though. ?connections will get you started. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA "The business of the statistician is to catalyze the scientific learning process." - George E. P. Box > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Sachin J > Sent: Friday, August 18, 2006 9:14 AM > To: [email protected] > Subject: [R] dataframe of unequal rows > > Hi, > > How can I read data of unequal number of observations > (rows) as is (i.e. without introducing NA for columns of less > observations than the maximum. Example: > > A B C D > 1 10 1 12 > 2 10 3 12 > 3 10 4 12 > 4 10 > 5 10 > > Thanks in advance. > > Sachin > > > > > --------------------------------- > > [[alternative HTML version deleted]] > > ______________________________________________ > [email protected] 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. > ______________________________________________ [email protected] 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.
