I have a quick formatting question. I have a set of data in a data frame that looks like this:
Animal Food Food ID
dog steak 100
dog beef 200
dog poo 001
cat milk 020
cat steak 100
cat beef 200
which, for programming input purposes, I need to transform into a '.txt' file with a format like this :
<dog>
steak 100
beef 200
poo 001
</dog>
<cat>
milk 020
steak 100
beef 200
</cat>
Obviously my real data has tens of thousands of entries or else I could do it by hand. Any suggestions would be great. Thanks.