0

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?

user4157124
  • 2,809
  • 13
  • 27
  • 42
Audrey
  • 212
  • 4
  • 15
  • Don't forget to add `ffwhich(df_ff, names == 'B')` in your list :) –  Feb 25 '14 at 15:20
  • @jwijffels Do you think the discrepancy between 1) and 2) is a bug? – Audrey Feb 25 '14 at 17:03
  • If you think this is a bug, you could report it at https://github.com/edwindj/ffbase. I believe it is more a feature request but indeed it might be convenient. I also get annoyed by this discrepancy sometimes. I think we should allow `ffwhich(df_ff[[1]] == 'B')` also to work. Do post this at https://github.com/edwindj/ffbase –  Feb 26 '14 at 08:50

0 Answers0