tableAgent: A chain-method table class in Matlab

版本 2.0.1 (2.0 MB) 作者: Renwen Lin
@tableAgent: A class for applying chain method on table in Matlab, and providing with many useful methods functions
30.0 次下载
更新时间 2019/3/7

tableAgent: A chain-method table class in Matlab

methods of tableAgent:

areParensNext droprow numArgumentsFromSubscript stackCell
blockCopy gen numel stackCell2
blockExchange gen_dummy pivot subsasgn
cmdstrStandardize gen_forEachCol plotcols subsref
col gen_slice plotcolsNumber subsrefDot
colbyLabel genbygroup queryTabAinTabB summary
colstr2coldouble groupby renamecol tableAgent
colstrLabel2coldouble height row unstack
copykeyproperties istableAgent rowstr2rowdouble varargout_demo
disp keepcol runCmdGen width
dispBasicProperties keeprow size
dispclass merge sortrows
dropcol mergeTables stack

1.1 objective
1.2 Install
1.3 usage
1.4 requirement
Author: linrenwen@gmail.com

1.1 objective
@tableAgent: create a class for applying chain method on table in Matlab

1.2 Install
All files you need are included in tableAgent_test.zip.

unzip the tableAgent_test.zip. and add the folder to matlab path.
run tableAgent_test.m for examples.

1.3 usage
See tableAgent_test.m for List of all features.

data construction
%% data construction method 1
T = tableAgent;
T.name = ["Joan","Merry","Tom","Kate"]';
T.sex = ["male","female","male","female"]';
T.grade = [99,67,66,35]';
T.G = [99,67,88,55]'+ 4;

%% data construction method 2
T = table;
T.name = ["Joan","Merry","Tom",
TB = tableAgent(T);
generate new col or variable, by passing variable x
%% Test of passing variable x
para.x = [1,1]';
TB = T.row([1,2]).gen('Gx=grade + para.x',para);
generate new col or variable, by passing inline-function para
%% Test of passing inline-function para
fnew = @(x)(x+3);
TB = T.row().gen('G=fnew(pi)',fnew,'fnew');
TB = T.row().gen('G2=fnew(pi)',fnew,'fnew');
generate new col by group operation
%% chain method demo
TB = T.row('G>=60').groupby('sex').genbygroup('SexPlus = G+1')...
.genbygroup('SexPlus = sex+"plus"');
test of dropcols and droprows
TB = T.row([1,2]).droprow('G==71');
TB = T.keeprow([1,3,4]);
TB = T.dropcol(2).row(3).droprow().keepcol('name,G');

TB = T.droprow('G==71');
TB = T.row(1).droprow()
index of table Agent
%% Test of assign
T{1,2:3} = [33,55];
T{1,1} = "Joan,Hi";
chain-method operation
%% chain method demo
TB =T.row('grade==67|grade<38').gen('grade = grade+1').gen('G = grade*2')...
.row('grade<=99').gen('G = log(grade)*10')...
.row([1,3]).gen('G=3')...
.row().gen('G=pi');
disp
%% test of disp
T = T.row([1,2]);
T.gen('G=2').dispclass;
dispclass(T);
disp(T);
disp(T.table);

1.4 requirement
Matlab 2018b

引用格式

Renwen Lin (2024). tableAgent: A chain-method table class in Matlab (https://github.com/homecls/tableAgent), GitHub. 检索来源 .

MATLAB 版本兼容性
创建方式 R2018b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Tables 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

无法下载基于 GitHub 默认分支的版本

版本 已发布 发行说明
2.0.1

list of methods of tableAgent

2.0

add pivot, stack, stackCell, plotcols, gen_slice and other methods for tableAgent class

1.041.0.3

add method of stack and unstack

1.0.3

update readme.md

1.0.2

Update Readme

1.0.1

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库