Finished the Week 3 of R programming.
Learned several split-and-combine functions
lapply : return a list;
sapply : simplified result of lapply
apply: apply functions on the matrix, directions (rows or columns) could be chosen.
tapply: subsetting the vectors and then apply functions on each sub group and get result.
mapply : apply funcitons on multiple inputs.
split: split a matrix according to subsetting index. combine with lapply or sapply it could achieve effects as tapply(but potentially more powerful)
Work:
Tried butterknife
Evening
finished the interface pattern
And read the composite design pattern.
The composite pattern suits for tree structure.
There are three classes:
Component : the base class for composite and leaf
Composite: a concrete component class that ‘contains’ multiple component classes which could be either composite or leaf.
leaf: just a concrete component class
There are also two ways implementing it:
transparent: all methods are in base class – Component
safe : some methods are in composite class, avoid accessed through leaf.