tableAgent: A chain-method table class in Matlab

Version 2.0.1 (1,96 MB) von Renwen Lin
@tableAgent: A class for applying chain method on table in Matlab, and providing with many useful methods functions
30 Downloads
Aktualisiert 7 Mär 2019

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

Zitieren als

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

Kompatibilität der MATLAB-Version
Erstellt mit R2018b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Tables finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!

Versionen, die den GitHub-Standardzweig verwenden, können nicht heruntergeladen werden

Version Veröffentlicht Versionshinweise
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

Um Probleme in diesem GitHub Add-On anzuzeigen oder zu melden, besuchen Sie das GitHub Repository.
Um Probleme in diesem GitHub Add-On anzuzeigen oder zu melden, besuchen Sie das GitHub Repository.