## einfo() defaults to retmode 'xml'
e <- einfo()
## automatically return data as an 'XMLInternalDocument'.
if (e$no_errors()) {
content(e)
## return the XML data as character string.
cat(content(e, "text"))
## return DbNames parsed into a character vector.
content(e, "parsed")
}
## return data as a JSON object
e2 <- einfo(db = "gene", retmode = "json")
if (e2$no_errors()) {
content(e2)
}
## return a textConnection to allow linewise reading of the data.
x <- efetch("CP000828", "nuccore", rettype = "gbwithparts", retmode = "text")
con <- content(x, as = "textConnection")
readLines(con, 2)
close(con)Run the code above in your browser using DataLab