将所选区域转换为组织表

时间:2019-10-09 10:06:39

标签: emacs org-mode

我有这样的障碍

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

如何将其转换为组织表?

1 个答案:

答案 0 :(得分:3)

假设第一和第二列之间有一个TAB,请标记该区域并说出<body> <div id="multiselect"></div> <script id="multiselectTemplate" type="text/x-jsrender"> <select id="leftSelect" multiple> {^{for left}} <option data-link="value{:#index}">{^{:name}}</option> {{/for}} </select> <button id="rightButton"> > </button> <button id="leftButton"> < </button> <select id="rightSelect" multiple> {^{for right}} <option data-link="value{:#index}">{^{:name}}</option> {{/for}} </select> </script> <script> var data = { left: [{ "id": 0, "name": "Melendez Garner" }, { "id": 1, "name": "Mara Orr" }, { "id": 2, "name": "Bass Salazar" }, { "id": 3, "name": "Carol Freeman" }, { "id": 4, "name": "Selma Bradford" }, { "id": 5, "name": "Cotton Parrish" }, { "id": 6, "name": "Haley Campbell" }, { "id": 7, "name": "Ruth Wright" }, { "id": 8, "name": "Carmella Blake" }], right: [] } data.left.sort((a, b) => a.name.localeCompare(b.name)); var m = $.templates('#multiselectTemplate').link('#multiselect', data); $('#multiselect').on('click', '#leftButton', function () { //MOVE FROM RIGHT TO LEFT var view = $.view(this); var value = $('#rightSelect').val(); if (value === null) return; //moveFromToType2(data.right, data.left, value); moveFromTo(data.right, data.left, value); //view.refresh(); }).on('click', '#rightButton', function () { //MOVE FROM LEFT TO RIGHT var view = $.view(this); var value = $('#leftSelect').val(); if (value === null) return; //moveFromToType2(data.left, data.right, value); moveFromTo(data.left, data.right, value); //view.refresh(); }) function moveFromToType2(from, to, index) { if (from.length == 0) return; if (index !== undefined) { let selected = index.map(d => from[d]); selected.forEach(d => { let i = from.indexOf(d); from.splice(i, 1); }); $.observable(to).insert(selected); to.sort((a, b) => a.name.localeCompare(b.name)); from.sort((a, b) => a.name.localeCompare(b.name)); } } function moveFromTo(from, to, index) { if (from.length == 0) return; if (index !== undefined) { let selected = index.map(d => from[d]); selected.forEach(d => { let i = from.indexOf(d); $.observable(from).remove(i); }); $.observable(to).insert(selected); to.sort((a, b) => a.name.localeCompare(b.name)); from.sort((a, b) => a.name.localeCompare(b.name)); $.observable(to).refresh(to); $.observable(from).refresh(from); } } </script> C-u C-u M-x org-table-convert-region RET的文档字符串讨论了分隔符的其他可能性:

org-table-convert-region