Skip to content
Prev 77226 / 398502 Next

Scan and Lists

Hi Michael

An example of your list would have helped.  Anyhow, why do you want to read 
a list? If you created a list object in R and want to save it and then read 
it back in other session or in some other time a good option is to write an 
ASCII representation of the object using dput and then recreate it using 
dget i.e.

mylist= list(x=cars[,1], y=cars[,2])
dput(mylist,"mylist")
mylistback=dget("mylist")
$x
[1]  4  4  7  7  8  9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 
15
[26] 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 
25

$y
[1]   2  10   4  22  16  10  18  26  34  17  28  14  20  24  28  26  34  34  
46
[20]  26  36  60  80  20  26  54  32  40  32  40  50  42  56  76  84  36  46 
  68
[39]  32  48  52  56  64  66  54  70  92  93 120  85

If you want to read some other type of data take a look at the higher lever 
functions listed under ?read.table and the functions at 
library(help="foreign")

I hope this helps

Francisco

PS: Nasty weather in Fort Collins today!