Fix slow take(): deserialize only up to necessary # of elements.
Min() upper-bound size with actual size.
Apply size-capping on logical representation instead of physical.

- This supercedes the previous commit, which is a wrong fix.
- Also, modify take() test slightly to cover all cases.
Fix: only optimize for unserialized dataset case.
Merge pull request #108 from concretevitamin/take-optimize

[SPARKR-139] Fix slow take(): deserialize only up to necessary # of elements.