Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Ch 9-10 lSubsetting lOrdering lArray operations lIteration © Fall 2004 Don Edwards and the University of South Carolina.

Similar presentations


Presentation on theme: "1 Ch 9-10 lSubsetting lOrdering lArray operations lIteration © Fall 2004 Don Edwards and the University of South Carolina."— Presentation transcript:

1 1 Ch 9-10 lSubsetting lOrdering lArray operations lIteration © Fall 2004 Don Edwards and the University of South Carolina

2 2 9 Subsetting and sorting lExtraction with “[]” for vectors and matrices l: and c() lRows, columns, and sub-matrices lIndices are not extracted lExtraction with logical vectors lStatements look self-referential

3 3 9 Subsetting and sorting lOrder function lCreates vector of indices that can then be used to “extract” ordered data files lLike a logical vector, the focus is on the index object, not the output object lSort function lacks functionality

4 4 10 Matrix operations lSplus was very inefficient at looping lR is improved lBoth Splus and R have built-in iterative capabilities lFunctions that operate on vectors and arrays lThe apply() function ltapply() works on groups

5 5 10 Matrix operations lIf we need to iterate, we use for() and while() statements lfor() uses a counter lwhile() uses a logical comparison lIf for() is slow, R can call both C++ and Fortran subroutines


Download ppt "1 Ch 9-10 lSubsetting lOrdering lArray operations lIteration © Fall 2004 Don Edwards and the University of South Carolina."

Similar presentations


Ads by Google