Hello,
Suppose that you have a data frame 'df' with variables 'V1', 'V2', 'V3',
etc.
Is there any (performance) difference (except the difference of the return
types)
between the following two computations?
subset(df, V1 0, V2)
and
df$V2[df$V1 0]
Best Regards,
hyunjo
On Sat, 26 Sep 2009 15:26:12 +0900 You Hyun Jo youhyu...@gmail.com
wrote:
YHJ Is there any (performance) difference (except the difference of
YHJ the return types)
YHJ between the following two computations?
Try it yourself.
?system.time
is useful for that purpose.
Stefan
Thanks, Stefan.
I tested the expressions over a set of various size of data frames.
The result shows 2) and 3) are faster than 1) especially over a data frame
with a large number of columns. The third one is probably the best.
1) subset(df, V1 0, V2) or subset(df, V1 0, V2)$V2
2) df[df$V1
3 matches
Mail list logo