Dear R list, I am trying to read files with a varying number of columns and can't figure out how to get them in the proper format. Some rows have five value and some have seven. Is there a way to read them in so that two empty columns are added to every row that has only five values? An example of the data follows. Thanks! Tim
>46,B,00301,2004-02-03,11:59:16 >46,B,00301,2004-02-03,12:03:43 >46,B,00301,2004-02-03,12:39:17 >46,B,00301,2004-02-03,23:07:28 >43,C,00232,2004-02-04,07:39:57,-1.5,meters >44,A,00230,2004-02-04,07:44:59 >44,A,00230,2004-02-04,07:46:19 >44,A,00230,2004-02-04,07:48:24 >44,A,00230,2004-02-04,07:49:12 >43,C,00232,2004-02-04,07:53:08,2.5,meters >44,A,00230,2004-02-04,07:54:34 >44,A,00230,2004-02-04,07:55:08 >43,C,00232,2004-02-04,07:56:18,2.9,meters >43,C,00232,2004-02-04,07:56:39,2.5,meters >46,B,00301,2004-02-04,08:00:49 >43,C,00232,2004-02-04,08:02:12,-1.1,meters >43,C,00232,2004-02-04,08:04:01,2.2,meters >43,C,00232,2004-02-04,08:04:26,3.3,meters >43,C,00232,2004-02-04,08:40:26,2.9,meters >43,C,00232,2004-02-04,08:41:04,-2.2,meters >43,C,00232,2004-02-04,08:42:44,2.2,meters >43,C,00232,2004-02-04,08:44:31,2.9,meters >44,A,00231,2004-02-04,09:04:43 >44,A,00231,2004-02-04,09:10:30 >44,A,00231,2004-02-04,09:12:08 >44,A,00231,2004-02-04,09:13:32 >44,A,00231,2004-02-04,09:14:06 >43,C,00232,2004-02-04,09:18:24,0.4,meters >43,C,00232,2004-02-04,09:20:13,2.5,meters >44,A,00231,2004-02-04,09:21:04 >44,A,00231,2004-02-04,09:22:53 >44,A,00231,2004-02-04,09:25:32 >44,A,00231,2004-02-04,09:29:31 >44,A,00231,2004-02-04,09:30:05 >43,C,00232,2004-02-04,09:53:25,2.5,meters >43,C,00232,2004-02-04,09:53:53,1.5,meters >46,B,00301,2004-02-04,22:16:24 >46,B,00301,2004-02-04,22:19:32 >46,B,00258,2004-02-04,23:44:01 >46,B,00258,2004-02-04,23:44:28 Tim Clark Marine Ecologist National Park of American Samoa Pago Pago, American Samoa 96799 ______________________________________________ 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.