[R] Help with capture.output

Joel joda2457 at student.uu.se
Mon Dec 6 10:51:41 CET 2010


Hi 

Im trying to capture the output of HTML but dont really get what I want

As an example:
> y<-data.frame(a=c(1,2,3),b=c(1,2,3),c=c(1,2,3))
> toReturn<-capture.output(HTML(y,file=""));

This gives me the output of toReturn as an vector:

> toReturn
 [1] ""                                                       
 [2] ""                                                       
 [3] "<p align= center >"                                     
 [4] "<table cellspacing=0 border=1>"                         
 [5] "<caption align=bottom class=captiondataframe></caption>"
 [6] "<tr><td>"                                               
 [7] "\t<table border=0 class=dataframe>"                     
 [8] "\t<tbody> "                                             
 [9] "\t<tr class= firstline > "                              
[10] "\t\t<th>   </th>"                                  
[11] "\t\t<th>a  </th>"                                       
[12] "\t\t<th>b  </th>"                                       
[13] "\t\t<th>c</th> "                                        
[14] "\t</tr> "                
.
.
.


But what I want is a continues string of the code on just one row:
[1] "<p align= center > <table cellspacing=0 border=1> <caption align=bottom
class=captiondataframe></caption> ..."

Anyone know a way I can accomplish this?

/Joel

-- 
View this message in context: http://r.789695.n4.nabble.com/Help-with-capture-output-tp3074192p3074192.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list