question on write.table

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

question on write.table

Weiwei Shi
Hi,
I have a question on write.table:
I have a data.frame called t7 as below:

> dim(t7)
[1] 14015184        6
> t7[1:5,]
  uci uce par line graphical.forms  stems
1   0   0   0    0          active  activ
2   0   0   0    0          policy polici
3   0   0   0    0              wc     PC
4   0   0   0    0             eff    elf
5   0   0   0    0             icn    ICC

I want to write the contents of t7 into a file, which can be read
later by a python program. So I used:
write.table(t7,file="map")

, which of course takes forever.

Is there another way to make it finish in a standable time?

I have to use old R version since I need to use ttda package.
> version
         _
platform x86_64-unknown-linux-gnu
arch     x86_64
os       linux-gnu
system   x86_64, linux-gnu
status
major    2
minor    0.1
year     2004
month    11
day      15
language R

My linux box has 8 G memory.

Thank you for your help!

Weiwei
--
Weiwei Shi, Ph.D

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III

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

Re: question on write.table

Peter Dalgaard
Weiwei Shi <[hidden email]> writes:

> Hi,
> I have a question on write.table:
> I have a data.frame called t7 as below:
>
> > dim(t7)
> [1] 14015184        6
> > t7[1:5,]
>   uci uce par line graphical.forms  stems
> 1   0   0   0    0          active  activ
> 2   0   0   0    0          policy polici
> 3   0   0   0    0              wc     PC
> 4   0   0   0    0             eff    elf
> 5   0   0   0    0             icn    ICC
>
> I want to write the contents of t7 into a file, which can be read
> later by a python program. So I used:
> write.table(t7,file="map")
>
> , which of course takes forever.
>
> Is there another way to make it finish in a standable time?

If the only purpose is to write something that python can read, might
it not be more expedient to teach python some other data format that R
can generate easily? E.g. dump() or save(..., ascii=TRUE) ?
 

> I have to use old R version since I need to use ttda package.
> > version
>          _
> platform x86_64-unknown-linux-gnu
> arch     x86_64
> os       linux-gnu
> system   x86_64, linux-gnu
> status
> major    2
> minor    0.1
> year     2004
> month    11
> day      15
> language R
>
> My linux box has 8 G memory.
>
> Thank you for your help!
>
> Weiwei
> --
> Weiwei Shi, Ph.D
>
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
>
> ______________________________________________
> [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
>

--
   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
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

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

Re: question on write.table

Prof Brian Ripley
In reply to this post by Weiwei Shi
Note that write.table is very much faster in current versions of R.
So you could save the object, read it into 2.2.1 (beta) and write it out
there.

On Thu, 15 Dec 2005, Weiwei Shi wrote:

> Hi,
> I have a question on write.table:
> I have a data.frame called t7 as below:
>
>> dim(t7)
> [1] 14015184        6
>> t7[1:5,]
>  uci uce par line graphical.forms  stems
> 1   0   0   0    0          active  activ
> 2   0   0   0    0          policy polici
> 3   0   0   0    0              wc     PC
> 4   0   0   0    0             eff    elf
> 5   0   0   0    0             icn    ICC
>
> I want to write the contents of t7 into a file, which can be read
> later by a python program. So I used:
> write.table(t7,file="map")
>
> , which of course takes forever.
>
> Is there another way to make it finish in a standable time?
>
> I have to use old R version since I need to use ttda package.
>> version
>         _
> platform x86_64-unknown-linux-gnu
> arch     x86_64
> os       linux-gnu
> system   x86_64, linux-gnu
> status
> major    2
> minor    0.1
> year     2004
> month    11
> day      15
> language R
>
> My linux box has 8 G memory.
>
> Thank you for your help!
>
> Weiwei
> --
> Weiwei Shi, Ph.D
>
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
>
> ______________________________________________
> [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
>

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[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