[R] Exporting an list()

Henrique Dallazuanna wwwhsd at gmail.com
Tue Jul 15 15:14:07 CEST 2008


Maybe you can use the dput:

x <- list(VAR1 = data.frame(x=rnorm(10), y=rnorm(10)),
          VAR2 = data.frame(x=rnorm(10), y=rnorm(10)))

dput(x, file='list.txt')
x <- source('list.txt')[[1]]

On Tue, Jul 15, 2008 at 10:10 AM, Leandro Marino
<leandro at cesgranrio.org.br> wrote:
> Hi,
>
> I have an list() like this:
>
> $VAR1
>     Num   Perc  media stdev   min     P5    P10    P25
> 1   4381  56.35 181.35 39.81 87.13 123.05 132.59 152.95
> 2   1628  20.94 192.83 43.76 87.13 125.09 138.78 162.04
> 3    786  10.11 197.23 50.65 88.16 120.46 136.62 159.33
> 4    980  12.60 170.90 38.34 86.98 114.27 126.84 144.04
> tot 7775 100.00 184.05 42.40 86.98 122.34 132.66 153.69
>
> $VAR2
>     Num   Perc  media stdev   min     P5    P10    P25
> 1   4296  55.25 182.04 40.90 87.13 122.62 132.51 153.06
> 2   1634  21.02 191.57 43.81 86.98 126.87 137.04 160.35
> 3    695   8.94 189.29 46.98 88.16 120.15 132.29 155.60
> 4   1150  14.79 177.66 41.13 92.47 116.22 129.17 147.23
> tot 7775 100.00 184.05 42.40 86.98 122.34 132.66 153.69
>
> How can I export that into a .txt?
>
> I tried the write.table but isn't working. It returns
>
> Erro em data.frame(Q05 = c(4381, 1628, 786, 980, 7775, 56.35, 20.94,  :
>  arguments imply differing number of rows: 5, 3, 4, 6
>>
>
>
> Thanks for the help!
>
> Leandro Marino
>
> ______________________________________________
> R-help at 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list