我正在阅读一些R代码,并遇到了此命令
%&%
有人有什么想法吗?
谢谢!
答案 0 :(得分:1)
这取决于库,但是您的意思可能是$('#dataTableId').DataTable({
// I use the "columns" option to tell each column what data to show.
// One column should have a uniquely id'ed canvas.
"columns": [
{ "data": "id" },
{ "data": "A" },
{ "data": "B" },
{ "data": function(row){
return "<canvas height=\"40px\" width=\"40px\" id=\"chart"+row.id+"\"></canvas>";
},
"orderable": false}
],
"drawCallback": function() {
// Get data, only from the rows displayed on the current page.
var data = this.api().rows({page:'current'}).data();
// The first draw appears to have a length of 0,
// but subsequent ones have length equal to number of rows drawn.
if (data.length !== 0){
// Loop through each row to render each chart
for (var i = 0; i < data.length; i++) {
// Find the chart intended for this data
var ctx = $("#chart"+data[i].id);
// Make the chart
var newChart = new Chart(ctx, {
"type": "doughnut",
"data": {
"labels": [
"A",
"B"
],
"datasets": [{
"data": [data[i].A,data[i].B]
}],
},
}) // /Chart
}
}
}
// In a real table, the object passed into the DataTable() function will
// probably also use other options, such as "ajax", "serverSide" or
// "pageLength". For simplicity, only "columns" and "drawCallback" are
// shown in this example.
}); // /DataTable
。
来自qdap
documentation:
qdap
也可能是:
https://www.rdocumentation.org/packages/Matrix/versions/1.2-8/topics/%25%26%25-methods
例如
qdap Chaining
%&% - Chain qdap_dfs to qdap functions with a text.var argument. Saves typing of an explicit text.var argument and supplying a data.frame.
Keywords
chain, chaining, pipe
Usage
qdap_df.object %&% qdap.fun