Closed mattwarkentin closed 3 years ago
hmm it looks like a bug in collect()
, I'll fix it thanks for reporting.
By the way, it seems you're missing a drop = FALSE
here:
self$data[i, ]
If the data frame ends up having 1 column, subsetting rows without turning off drop
will also unwrap the data frame.
x <- mtcars[1]
x[1:3, ]
#> [1] 21.0 21.0 22.8
Thanks for the reply. Yes, this example was hacky, just playing around with the new package.
Hi @lionel-,
I am just playing with
coro
and it was perhaps surprising to me that when looping over aniterator
withloop()
andfor
, that the yields from the iterator are different than if I callcollect()
. Is this behaviour expected? Am I misunderstanding/misusing these functions? Should iterators only ever return single-element objects?collect()
returns a list with an element for each column-value for a given row, whileloop()/for
return the expected value which is a single row of data.