While working with xml data (bibliographical), I transformed the tags into a list via xmlToList command. The problem is that there are multiple elements with the same tag that show up as list elements with identical names, say, a coauthored piece would have two identical tags, which become two identical list object names like $rec$stuff$record$author. For example:
Suppose the list is called A1:
$`rec`$`header`$`controlInfo`$artinfo$aug$au
# [1] "Smith, Bob"
$`rec`$`header`$`controlInfo`$artinfo$aug$au
# [1] "Jones, Mike"
A1$`rec`$`header`$`controlInfo`$artinfo$aug$au
is always "Smith, Bob."
I can't seem to find an obvious way to refer to the second entry, "Jones, Mike" without renaming the list elements (for other reasons other than parsing the data, I'd rather not). Plus, I'd need to be able to assign NA's to the second spot if there is no second element with the same name if possible. Is there a way to do this?
Thanks in advance!