[R] customizing the number of decimal places in xtable: RESOLVED

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Tue Sep 18 09:24:31 CEST 2018


I gather you find the content of the help page for the xtable function hard to understand, but you need to build the skill of reading them and gathering clues about functions you call from them.

* They always have a usage section that briefly summarizes how the function is called and what the default values are for those parameters that do have defaults.

* They always mention what each parameter is for. (The help page may not always be thorough enough to suit your preference, but CRAN requires the author to make some effort to describe every parameter. Note that people posting packages on GitHub have no one insisting that they put in this effort, so beware that quality may vary more if you start using non-CRAN packages.) The digits parameter is used by many data formatting functions, and it can usually be specified as a vector with each element affecting a corresponding column of data in order.

* They always indicate what kind of Value will be returned from the function.

* They usually have Notes on how the function reacts to different input values.

* They often have Examples of how to use the function.

* They often have  a See Also section indicating what other functions you might find relevant when using this function.

* They sometimes have a section listing References to read to learn more about the theory behind the function.

Not all authors of help pages put the same level of effort into making help pages readable, and there is undoubtedly some shorthand notation that gives you key information more compactly than you might wish for as a beginner. However, if you ask for help interpreting specific help pages then you may learn more about how they work or the authors may re-write certain help pages based on your questions to address the source of your confusion.  Beware that if you don't read them first and mention why they didn't answer your question then you may get less helpful responses when when you do ask questions.

On September 17, 2018 10:49:43 PM PDT, Ogbos Okike <giftedlife2014 using gmail.com> wrote:
>Dear Jeff,
>
>Thank you please.
>
>I did search before but could not get it resolved. But with your query
>now,
>just typed ?xtable as key  search word and the first document I opened
>gave
>an indication of digits. Without knowing what it was saying, I tried it
>in
>my data and it gave the result I have been looking for.
>
>xtable(data, digits=12) and I am fine.
>
>Thank you so much.
>
>Ogbos
>
>On Tue, Sep 18, 2018 at 6:27 AM Jeff Newmiller
><jdnewmil using dcn.davis.ca.us>
>wrote:
>
>> Have you read
>>
>> ?xtable
>>
>>
>> On September 17, 2018 7:24:37 PM PDT, Ogbos Okike <
>> giftedlife2014 using gmail.com> wrote:
>> >Dear Volunteers,
>> >
>> >I have a table involving many decimal places:
>> >2005-01-04 -2.13339817688037
>> >2005-01-19 -6.86312349695117
>> >2005-01-22 -4.33662370554386
>> >2005-02-10 -1.40789214441639
>> >2005-02-13 -1.1334121785854
>> >2005-02-19 -1.28411233010119
>> >2005-05-09 -1.6895978161324
>> >2005-05-16 -3.07664523496947
>> >2005-06-17 -1.69904491217129
>> >2005-07-17 -3.44289318667434
>> >2005-08-07 -2.29676435700659
>> >2005-08-10 -1.08915071542227
>> >2005-08-24 -1.8244123081697
>> >2005-09-13 -4.57899147546373
>> >2005-09-15 -3.96591895962343
>> > I used xtable to covert this to form of latex table.
>> >
>> >The result I have is:
>> >1 & 2005-01-04 & -2.13 \\
>> >  2 & 2005-01-19 & -6.86 \\
>> >  3 & 2005-01-22 & -4.34 \\
>> >  4 & 2005-02-10 & -1.41 \\
>> >  5 & 2005-02-13 & -1.13 \\
>> >  6 & 2005-02-19 & -1.28 \\
>> >  7 & 2005-05-09 & -1.69 \\
>> >  8 & 2005-05-16 & -3.08 \\
>> >  9 & 2005-06-17 & -1.70 \\
>> >  10 & 2005-07-17 & -3.44 \\
>> >  11 & 2005-08-07 & -2.30 \\
>> >  12 & 2005-08-10 & -1.09 \\
>> >  13 & 2005-08-24 & -1.82 \\
>> >  14 & 2005-09-13 & -4.58 \\
>> >  15 & 2005-09-15 & -3.97 \\.
>> >
>> >It has truncated the long decimal places. Since it is not want I
>want,
>> >I
>> >have to copy from the original table and place into xtable.
>> >
>> >Can you please tell me how to customize the xtable so that I will be
>> >responsible for the number of decimal places it displays.
>> >
>> >Many thanks for your precious time.
>> >
>> >Warmest regards
>> >Ogbos
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> >______________________________________________
>> >R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> >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.
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>

-- 
Sent from my phone. Please excuse my brevity.




More information about the R-help mailing list