0

I have such a block

Function    Description
count   Number of non-NA observations
sum     Sum of values
mean    Mean of values
mad     Mean absolute deviation
median  Arithmetic median of values
min     Minimum
max     Maximum
mode    Mode
abs     Absolute Value
prod    Product of values
std     Bessel-corrected sample standard deviation
var     Unbiased variance
sem     Standard error of the mean
skew    Sample skewness (3rd moment)
kurt    Sample kurtosis (4th moment)
quantile    Sample quantile (value at %)
cumsum  Cumulative sum
cumprod     Cumulative product
cummax  Cumulative maximum
cummin  Cumulative minimum

How could convert it to org table?

  • 2
    Please don't post the same question to StackOverflow and emacs.SE. Please choose one and delete the other. Thx. – Drew Oct 9 at 14:00
1

There's a function org-table-convert-region:

org-table-convert-region is an interactive autoloaded compiled Lisp
function in ‘org-table.el’.

(org-table-convert-region BEG0 END0 &optional SEPARATOR)

Convert region to a table.

The region goes from BEG0 to END0, but these borders will be moved
slightly, to make sure a beginning of line in the first line is included.

SEPARATOR specifies the field separator in the lines.  It can have the
following values:

(4)     Use the comma as a field separator
(16)    Use a TAB as field separator
(64)    Prompt for a regular expression as field separator
integer  When a number, use that many spaces, or a TAB, as field separator
regexp   When a regular expression, use it to match the separator

Note that your table has an inconsistent number of spaces between the function and the description, so we can't use the integer argument.

So we can provide three prefix arguments to the function (C-u C-u C-u M-x org-table-convert-region RET), to make it prompt for a regex.

The regex \{2,\} (two or more spaces) will match what we want.

Overall, this will do it: C-u C-u C-u M-x org-table-convert-region RET SPC {2,} RET.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.