Open swang87 opened 5 years ago
Look into 'where()' function in pryr.
This is subtle. If I say:
x <- iris
fc(sample, x = head(x)
does this mean I want x
to be the first 6 rows of iris or does it mean that I should take the first 6 elements of whatever is passed to the return function and sample from it? I think the answer is the latter. In this case, if we really want to sample from letters
, like in the example you could say:
fc(sample, x = base::letters)
Here I'm explicitly referencing an object in it's environment.
It seems like we might want to roll this change back.
Thoughts?
Note that even this isn't sufficient since:
letters[1] <- "A"
letters[1]
base::letters[1]
We could extend the ::
operator to look in the current environment.
I agree with your first comment. It's an excellent point that I totally didn't see before. Not quite understanding what you mean by the letters[1] example. Are you saying that we might potentially want:
fc(sample, x = head(letters,3) , size=n)
where letters is given by:
letters <- base::letters
letters[1] <- "A"
we may have issues?
Meeting 2/27: Include some extra info to tell fc() whether or not to bring in a global variable into the fc environment.
fc(sample, x = head(grab(iris)))
See for example,