Development

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Handling of tables in R

    5 answers - 1256 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi!
    I have a few questions concerning reading of tables from R to
    other programs. My main question is if s even possible to read a table
    created in R (with the functions data.frame and save) to Excel (or
    maybe SAS) and if so how does one do this? If I just mark the table in R
    and copy-paste to Excel the whole table ends up in one single cell, (of
    course). My goal is to copy the table to Excel (or SAS) in such a
    way that a single observation gets placed in a single cell.
    If this t possible, is there any way to reduce the number of
    digits in a table in R?
    I would be more than happy if there were any one who knows the
    answer to my questions!
    Thanks before hand,
    Fredrik Thuring
    Research department
    Codan Insurance, Copenhagen
    This e-mail and any attachment may be confidential and may also be privileged.
    If you are not the intended recipient, please notify us immediately and then
    delete this e-mail and any attachment without retaining copies or disclosing
    the contents thereof to any other person.
    Thank you.
    [[alternative HTML version deleted]]
    R-help (AT) stat (DOT) math.ethz.ch mailing list
    PLEASE do read the posting guide!
  • No.1 | | 1566 bytes | |

    Save your table in a text file ( see ?write.table ) with the separator
    set to "\t" ; you can then import it into excel

    for the nb of digits use
    >options(digits=3)


    see ?options

    Anne

    2005/8/19, Fredrik Thuring <frt (AT) codan (DOT) dk>:

    Hi!

    I have a few questions concerning reading of tables from R to
    other programs. My main question is if it's even possible to read a table
    created in R (with the functions data.frame and save) to Excel (or
    maybe SAS) and if so how does one do this? If I just mark the table in R
    and copy-paste to Excel the whole table ends up in one single cell, (of
    course). My goal is to copy the table to Excel (or SAS) in such a
    way that a single observation gets placed in a single cell.

    If this isn't possible, is there any way to reduce the number of
    digits in a table in R?

    I would be more than happy if there were any one who knows the
    answer to my questions!

    Thanks before hand,
    Fredrik Thuring
    Research department
    Codan Insurance, Copenhagen

    This e-mail and any attachment may be confidential and may also be privileged.
    If you are not the intended recipient, please notify us immediately and then
    delete this e-mail and any attachment without retaining copies or disclosing
    the contents thereof to any other person.
    Thank you.

    [[alternative HTML version deleted]]

    R-help (AT) stat (DOT) math.ethz.ch mailing list

    PLEASE do read the posting guide!
  • No.2 | | 1958 bytes | |

    Le 19.08.2005 11:22, Anne a :

    >Save your table in a text file ( see ?write.table ) with the separator
    >set to "\t" ; you can then import it into excel
    >
    >for the nb of digits use


    >
    >>options(digits=3)

    >
    >>

    >
    >see ?options
    >


    Hello,

    And if you run R on windows (just a guess because you didn't tell), the
    saving-to-a-file part is not necessary. use :
    Rwrite.table(your.data.frame, file='clipboard')
    and on excel "paste", your data should magically appear on excel

    Romain

    >Anne
    >
    >
    >2005/8/19, Fredrik Thuring <frt (AT) codan (DOT) dk>:


    >
    >Hi!
    >>

    >I have a few questions concerning reading of tables from R to
    >>other programs. My main question is if it's even possible to read a table
    >>created in R (with the functions data.frame and save) to Excel (or
    >>maybe SAS) and if so how does one do this? If I just mark the table in R
    >>and copy-paste to Excel the whole table ends up in one single cell, (of
    >>course). My goal is to copy the table to Excel (or SAS) in such a
    >>way that a single observation gets placed in a single cell.
    >>

    >If this isn't possible, is there any way to reduce the number of
    >>digits in a table in R?
    >>

    >I would be more than happy if there were any one who knows the
    >>answer to my questions!
    >>

    >Thanks before hand,
    >Fredrik Thuring
    >Research department
    >Codan Insurance, Copenhagen
    >
    >>
  • No.3 | | 1994 bytes | |

    Fri, 19 Aug 2005, Romain Francois wrote:

    Le 19.08.2005 11:22, Anne a :
    >
    >Save your table in a text file ( see ?write.table ) with the separator
    >set to "\t" ; you can then import it into excel
    >>

    >for the nb of digits use

    options(digits=3)

    for printing in R: see below for other suggestions.

    And if you run R on windows (just a guess because you didn't tell), the
    saving-to-a-file part is not necessary. use :
    Rwrite.table(your.data.frame, file='clipboard')
    and on excel "paste", your data should magically appear on excel

    You are likely to be better off with write.csv(). There _is_ a manual (`R
    Data Import/Export') about this. (In particular, the default setting for
    col.names in write.table is not usually what Excel usually expects, and
    the default separator is space, so you better not have spaces (or for
    Anne's suggestion, tabs) in the data.)

    Romain
    >
    >Anne
    >>
    >>

    >2005/8/19, Fredrik Thuring <frt (AT) codan (DOT) dk>:
    >>
    >>

    Hi!

    I have a few questions concerning reading of tables from R to
    other programs. My main question is if it's even possible to read a table
    created in R (with the functions data.frame and save) to Excel (or
    maybe SAS) and if so how does one do this? If I just mark the table in R
    and copy-paste to Excel the whole table ends up in one single cell, (of
    course). My goal is to copy the table to Excel (or SAS) in such a
    way that a single observation gets placed in a single cell.

    If this isn't possible, is there any way to reduce the number of
    digits in a table in R?

    ?round, ?signif, ?format. (Anne's answer applies to printing, not to the
    table and not to write.table/csv.)
  • No.4 | | 1363 bytes | |

    Fri, 19 Aug 2005, Prof Brian Ripley wrote:

    Fri, 19 Aug 2005, Romain Francois wrote:
    >
    >Le 19.08.2005 11:22, Anne a :
    >

    Save your table in a text file ( see ?write.table ) with the separator
    set to "\t" ; you can then import it into excel

    for the nb of digits use
    options(digits=3)

    for printing in R: see below for other suggestions.
    >
    >And if you run R on windows (just a guess because you didn't tell), the
    >saving-to-a-file part is not necessary. use :
    >Rwrite.table(your.data.frame, file='clipboard')
    >and on excel "paste", your data should magically appear on excel
    >

    You are likely to be better off with write.csv(). There _is_ a manual (`R
    Data Import/Export') about this. (In particular, the default setting for
    col.names in write.table is not usually what Excel usually expects, and the
    default separator is space, so you better not have spaces (or for Anne's
    suggestion, tabs) in the data.)

    Peter Dalgaard pointed out that write.table defaults to quoting, so it is
    quotes in fields that would be a problem not tabs/spaces. However,
    write.csv() is set up with the correct options for that, and also for the
    header line if row names are written (the default).
  • No.5 | | 873 bytes | |

    Fri, 19 Aug 2005, Fredrik Thuring wrote:
    I have a few questions concerning reading of tables from R to
    other programs. My main question is if s even possible to read a table
    created in R (with the functions data.frame and save) to Excel (or
    maybe SAS) and if so how does one do this? If I just mark the table in R
    and copy-paste to Excel the whole table ends up in one single cell, (of
    course). My goal is to copy the table to Excel (or SAS) in such a
    way that a single observation gets placed in a single cell.

    People have told you how to do this for Excel. For SAS you might want to
    try write.foreign() in the "foreign" package, which writes a text file and
    a SAS code file that you can use to read it into SAS.

    -thomas

    R-help (AT) stat (DOT) math.ethz.ch mailing list

    PLEASE do read the posting guide!

Re: Handling of tables in R


max 4000 letters.
Your nickname that display:
In order to stop the spam: 7 + 6 =
QUESTION ON "Development"

EMSDN.COM