fcuk icon indicating copy to clipboard operation
fcuk copied to clipboard

WIP: get_all_objects : search through colnames

Open statnmap opened this issue 5 years ago • 3 comments

This looks into object to find data.frame and extract colnames.

This should work as is, but this requires extra work to allow {fcuk} to categorize origin of proposed words.
Something like this would be more informative :

Did you mean ?
- function : length() ?
- object : iris ?
- colnames : Sepal.Length ?

statnmap avatar Jan 28 '21 08:01 statnmap

If data.frame subsetting threw a decent typed error when it couldn't find a column you could hook into that, but I don't think it does, a least yet

mtcars[, "foo"]
Error in `[.data.frame`(mtcars, , "foo") : undefined columns selected

jonocarroll avatar Jan 28 '21 08:01 jonocarroll

Also, with NSE, this looks like this

> ggplot(mtcars) + aes(x = foo, y = bar)
Error in FUN(X[[i]], ...) : objet 'foo' introuvable

or

> mtcars %>% filter(foo == "toto")
Erreur : Problem with `filter()` input `..1`.
x objet 'foo' introuvable
ℹ Input `..1` is `foo == "toto"`.
Run `rlang::last_error()` to see where the error occurred.

statnmap avatar Jan 28 '21 09:01 statnmap

There's a higher chance those are properly typed errors. I'm not entirely sure how to check.

jonocarroll avatar Jan 28 '21 09:01 jonocarroll