[R] rowspan and readHTMLTable
Chris Stubben
stubben at lanl.gov
Tue May 7 01:29:52 CEST 2013
I'm trying to read html tables with lots of rowspan attributes, for
example...
x<-htmlParse("<table>
<tr><td rowspan=2>ab</td><td>X</td></tr>
<tr><td rowspan=2>YZ</td></tr>
<tr><td>c</td></tr>
</table>")
readHTMLTable(x, which=1)
V1 V2
1 ab X
2 YZ <NA>
3 c <NA>
Does anyone know how to use the rowspan attributes and repeat cell
values to format a table like this?
V1 V2
1 ab X
2 ab YZ
3 c YZ
Also, the actual tables I'm using are large, for example, this one has
206 rows and rowspan attributes ranging from 2-14 scattered in all 8
columns, so the shifted rows in t1 are not very useful right now.
t1 <- readHTMLTable(
"http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3544749/table/T1", which=1)
Thanks,
Chris
t1<-readHTMLTable(
"http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3544749/table/T1", which=1)
--
Chris Stubben
Los Alamos National Lab
Bioscience Division
MS M888
Los Alamos, NM 87545
More information about the R-help
mailing list