Audrey
Audrey

Reputation: 322

R ff inconsistency with ffwhich?

I am trying to subset an ffdf object by selective indexing of its first column and came across the following paradox (inconsistency?):

# create an ffdf object:
> df_ff=as.ffdf(data.frame( names=c('B','A','B','A','A' ),numbers=1:5))

# 1) Works NOT:
> ffwhich(df_ff[[1]], df_ff[[1]] == 'B')
Error in which(eval(e, nl, envir)) : argument to 'which' is not logical

# 2) Works:
> x = df_ff[[1]]
> ffwhich(x, x == 'B')
ff (open) integer length=2 (2)
[1] [2] 
 1   3 

# 3) As an aside, this also works:
> ffwhich(df_ff, df_ff[[1]] == 'B')
ff (open) integer length=2 (2)
[1] [2] 
 1   3 

What is the difference between steps 1) and 2) , which would be identical for a ram R object?

Upvotes: 0

Views: 121

Answers (0)

Related Questions