Re: [R] Remove superscripts from HTML objects

2012-04-13 Thread S Ellison
 h - htmlpCatsupa/sup/ppDog/p/html
 sub(sup.*sup,,h)

Probably safer to do  

gsub(sup.*?sup,,h)

to avoid replacing multiple superscripts.

eg 
h2 - 
htmlpCatsupa/sup/ppDog/ppMousesupa/sup/ppRaccoon/p/html
sub(sup.*sup,,h2) #drops everything between first sup 
and last sup
gsub(sup.*?sup,,h2)#Drops each subxxx/sup


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@r-project.org 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.


Re: [R] Remove superscripts from HTML objects

2012-04-13 Thread Chris Stubben
Sorry if I was not clear.  I wanted to remove the superscripts using xpath
queries if possible.  For example this will get p nodes with superscripts,
but how do I remove the superscripts if there are many matching nodes and
different superscripts?

xpathSApply(doc, //p[sup], xmlValue) 
[1] Cata


Chris

--
View this message in context: 
http://r.789695.n4.nabble.com/Remove-superscripts-from-HTML-objects-tp4550738p4555370.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


Re: [R] Remove superscripts from HTML objects

2012-04-12 Thread mlell08
Hi,

h - htmlpCatsupa/sup/ppDog/p/html
sub(sup.*sup,,h)

see http://en.wikibooks.org/wiki/R_Programming/Text_Processing for more
information.

Regards!

__
R-help@r-project.org 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.