Re: [R] Import variable labels to data frame columns

2011-03-28 Thread AjayT
Hi, guys. Thanks for all your help. I tried Gabors methods and they seem to work fine - robust as well. I wish I had though of those a few days ago! I'll try and give the other methods a try later. In the end though this drove me so nuts that I've managed to query the database which outputed my

Re: [R] Import variable labels to data frame columns

2011-03-27 Thread Gabor Grothendieck
On Sun, Mar 27, 2011 at 9:40 PM, AjayT wrote: > Hi, I'm new to R and I'm stuck trying to import some data from a .dat file > I've been given. The tricky bit for me is that the data has both variable > values and labels? > > The data looks like this, > > Id=1 time=2011-03-27 19:23:40 start=1.4018  

Re: [R] Import variable labels to data frame columns

2011-03-27 Thread Jack Tanner
AjayT googlemail.com> writes: > The data looks like this, > > Id=1 time=2011-03-27 19:23:40 start=1.4018 end=1.4017 > Id=2 time=2011-03-27 19:23:40 start=1.8046 end=1.8047 Something like this would do: lines = scan(file, nlines=1, ...) fields = strsplit(lines[1], "\s+", perl=TR