excel - Best ways of getting tables from R into Libre Office Writer? -


currently, work flow statistics , data restructuring in r , write documents using libre office (lo) writer. results analyses in r tables , need these lo writer. have not found way directly in easy way, is: 1) put table in r, 2) export table .csv, 3) open .csv in lo calc, 4) copy lo calc lo writer using paste special rtf.

when saving .csv, doing using write.csv(table_1, "table_1.csv", na = ""). results in step because lo calc needs know how read .csv file. alternatively, 1 can install 1 of packages outputting .ods or .xls(x).

one problem doing way results in long decimal numbers in file, e.g. 2.21931, whereas 1 typically wants show 2 or 3 digits in document. have found 2 solutions annoyance.

the first round numbers in r using e.g. round(table_1, 2) , saving using above command. problem when 1 imports lo calc, numbers .60 become .6, losing (redundant) digit. makes inconsistent presentation. 1 can add them either in table in document or using rounding functions in lo calc.

the second use rounding function in libre office calc, requires few works/more work.

finally, when important tables lo writer this, table have invisible borders. 1 have add these manually every table.

what best way result tables r lo writer while avoiding significant digits problem , clicks?

try doing formatting in r functions sprintf(). it's best way i've found control display of digits. url below has working examples.

http://www.cookbook-r.com/strings/creating_strings_from_variables/

also, consider knitr package create documents on fly.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -