[R] [OT] (slightly) - OpenOffice Calc and text files

Charles C. Berry cberry at tajo.ucsd.edu
Wed Oct 13 21:51:22 CEST 2010


On Wed, 13 Oct 2010, Schwab,Wilhelm K wrote:

> It will get a good look, as will gnumeric - thanks to all!


emacs org-mode can convert your tab delimited file to a 'table' that you 
can edit either using org-mode functions OR as plain text by switching to 
fundamental mode.

In emacs speak, just put the cursor at the top of a buffer holding your 
file and do

 	M-x replace-string RET TAB RET | RET

I think, then move your cursor to a line that has a '|' in it and hit TAB, 
and you have a neatly formatted table.

See,

 	http://orgmode.org/worg/org-tutorials/tables.php

for an intro.

A big advantage in using an org-mode table is you can place an R source 
code block further down in the same file, and it can read in the data in 
the table. Then you can go back to the table to edit, then rerun R, ...

I append an example below.

There is a load of tutorial info at

 	http://orgmode.org/worg/org-tutorials/index.php

HTH,

Chuck


#+begin_example
#+tblname: simpleDF
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 5 | 4 | 2 |
|---+---+---|
#+end_example

#+begin_src R :var df=simpleDF :results output :colnames yes

    summary( df )

#+end_src

#+results:
:        a           b             c
:  Min.   :1   Min.   :2.0   Min.   :2.00
:  1st Qu.:2   1st Qu.:2.5   1st Qu.:2.25
:  Median :3   Median :3.0   Median :2.50
:  Mean   :3   Mean   :3.0   Mean   :2.50
:  3rd Qu.:4   3rd Qu.:3.5   3rd Qu.:2.75
:  Max.   :5   Max.   :4.0   Max.   :3.00



>
> Bill
>
>
>
> ________________________________________
> From: Albyn Jones [jones at reed.edu]
> Sent: Wednesday, October 13, 2010 2:14 PM
> To: Schwab,Wilhelm K
> Subject: Re: [R] [OT] (slightly) - OpenOffice Calc and text files
>
> emacs shows you exactly what is there, nothing more nor less.
> it isn't a spreadsheet, but tabs will align columns.
>
> albyn
>
> On Wed, Oct 13, 2010 at 01:53:46PM -0400, Schwab,Wilhelm K wrote:
>> Albyn,
>>
>> I'll look into it.  In fact, I have a small book on it that I bought in my very early days of using Linux.  I quickly found TeX Maker (for the obvious), Code::Blocks for C/C++ and I would not have started the move without a working Smalltalk (http://pharo-project.org/home).
>>
>> For editing data files, I really just want something that shows data in an understandable grid and does not do weird stuff thinking it's being helpful.
>>
>> Bill
>>
>>
>> ________________________________________
>> From: Albyn Jones [jones at reed.edu]
>> Sent: Wednesday, October 13, 2010 1:39 PM
>> To: Schwab,Wilhelm K
>> Cc: r-help at r-project.org
>> Subject: Re: [R] [OT] (slightly) - OpenOffice Calc and text files
>>
>> How about emacs?
>>
>> albyn
>>
>> On Wed, Oct 13, 2010 at 01:13:03PM -0400, Schwab,Wilhelm K wrote:
>>> Hello all,
>>> <.....>
>>> Have any of you found a nice (or at least predictable) way to use OO Calc to edit files like this?  If it insists on thinking for me, I wish it would think in 24 hour time and 4 digit years :)  I work on Linux, so Excel is off the table, but another spreadsheet or text editor would be a viable option, as would configuration changes to Calc.
>>>
>>> Bill
>>>
>>> ______________________________________________
>>> 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.
>>>
>>
>> --
>> Albyn Jones
>> Reed College
>> jones at reed.edu
>>
>>
>
> --
> Albyn Jones
> Reed College
> jones at reed.edu
>
> ______________________________________________
> 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list