[R] Import variable labels to data frame columns

AjayT ajaytalati at googlemail.com
Mon Mar 28 03:40:16 CEST 2011


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       end=1.4017   
Id=2 time=2011-03-27 19:23:40 start=1.8046       end=1.8047 
Id=1 time=2011-03-27 19:23:50 start=1.4017       end=1.4018   
Id=2 time=2011-03-27 19:23:50 start=1.8047       end=1.8046  

Is there a way to read the file into a dataframe or martix, so each line of
the file is read into a row, and the data labels are the columns. I'm try to
get it to look like this?

Id  time                          start      end
1  2011-03-27 19:23:40 1.4018  1.4017 
2  2011-03-27 19:23:40 1.8046  1.8047
1  2011-03-27 19:23:50 1.4017  1.4018 
2  2011-03-27 19:23:50 1.8047  1.8046

Its driving me nuts . Any help appreciated

--
View this message in context: http://r.789695.n4.nabble.com/Import-variable-labels-to-data-frame-columns-tp3410525p3410525.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list