Hi!

Does anybody know about an R function for importing paired 
name/value data, where each pair is separated by a fixed 
string (e.g., a semi-colon), and within each pair a 
different delimeter is used (e.g., an equals sign).
Example:

x="FirstName=John;LastName=Doe;Age=75;\nFirstName=Jane;LastName=Doe\nLastName=Bloggs;Age=42;FirstName=Joe"

Note that the order of the fields differ between the 
rows/records, and not all rows contain all fields.

The result should be a data frame:
  
FirstName    LastName   Age
John         Doe        75
Jane         Doe
Joe          Bloggs     42

I guess it’s not too difficult to write a function for this, 
using a bunch of strsplit functions and perhaps some 
rbind.fill and type.convert, but if there already exists such 
a function, there’s no need reinventing the wheel. :)

So, does anybody know of such a function? I tried searching 
for one, but I don’t know what this type of data format 
is called.

-- 
Karl Ove Hufthammer

______________________________________________
[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.

Reply via email to