Save R2HTML as an object instead of file

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Save R2HTML as an object instead of file

Joel
Hi

Is it possible to instead of getting the HTML code written to a file, get it saved as a string in an object instead?
Or is there any kind of package that can do this?
//Joel
Reply | Threaded
Open this post in threaded view
|

Re: Save R2HTML as an object instead of file

Gregoire Pau-3
Hi Joel,

The function hwrite() of the package hwriter does that.
 > library(hwriter)
 > hwrite(iris[1:10,])

See examples at http://www.embl.de/~gpau/hwriter/

Cheers,

Greg
---
Gregoire Pau
EMBL Research Officer
http://www.embl.de/~gpau/

On 01/12/10 08:53, Joel wrote:
>
> Hi
>
> Is it possible to instead of getting the HTML code written to a file, get it
> saved as a string in an object instead?
> Or is there any kind of package that can do this?
> //Joel

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Save R2HTML as an object instead of file

Joel
In reply to this post by Joel
Or is there any kind of File buffer that dossent save a file on the harddrive?

coz this gives me the thing I want but it still saves the file on the HD

> .HTML.file=(temp<-file("era.html","w+"))
> HTML("NANALALA")
> HTML(diag(3))


Then I can just use

readLines(temp) to get the result

but as I said I dont want it to save the HTML on the HD just in an object.
Reply | Threaded
Open this post in threaded view
|

Re: Save R2HTML as an object instead of file

Eric Lecoutre
In reply to this post by Joel
Hi Joel,

You can use:

obj=diag(3)
txt=capture.output(HTML(obj,file=""))

Then you may manipulate elements, paste with collapse argument, replace
parts with gsub and so on.

HTH,

Eric



2010/12/1 Joel <[hidden email]>

>
> Hi
>
> Is it possible to instead of getting the HTML code written to a file, get
> it
> saved as a string in an object instead?
> Or is there any kind of package that can do this?
> //Joel
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Save-R2HTML-as-an-object-instead-of-file-tp3066776p3066776.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



--
Eric Lecoutre
Consultant - Business & Decision
Business Intelligence & Customer Intelligence

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.