[R] Embedding datasets, was Re: srt --- slope text with function?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Feb 6 08:49:39 CET 2006


Duncan Murdoch <murdoch at stats.uwo.ca> writes:

> On 2/5/2006 4:28 PM, ivo welch wrote:

> > * has it now become possible to embed sample data sets in R code?  (I
> > asked this a while back, but there were nly kludges, no standard
> > "pretty" solutions.)
> 
> I don't understand the question.  dump() produces R code that can 
> reconstruct a dataset; is that what you want?

Or dput(). You can also read from a text connection, using
constructions like

data <- read.table(
textConnection(
"a b c d
2 1 3 5
0 2 4 1
1 2 3 4"), header=TRUE)

(The quotes have to placed as shown, or you get extra blank lines).
-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list