Closed eitsupi closed 4 months ago
Thanks for the suggestion.
Perhaps we should be doing a check for inherits(data, c("data.frame", "list"))
internally first anyway. Then we could attempt an as.data.frame
coercion if this condition is not met.
OTOH are we going to run into scoping issues because of confusion between the data
argument and utils::data()
function?
I wouldn't touch the data
directly but rely on the standard non-standard evaluation via model.frame()
. This is what base plot()
does but also lm()
and friends:
plot(Sepal.Length ~ Petal.Length, data = arrow::as_arrow_table(iris))
## Error in list(Sepal.Length, Petal.Length) :
## could not find function "list"
lm(Sepal.Length ~ Petal.Length, data = arrow::as_arrow_table(iris))
## Error in list(Sepal.Length, Petal.Length) :
## could not find function "list"
So this seems to be something to reconcile more generally, not necessarily within tinyplot
. Also, I'm not sure whether calling as.data.frame()
first might have any side effects for some of the objects that are currently supported.
Thanks for your prompt reply, perhaps this is a base function issue (not working properly for R6 classes?) as it works fine with polars::as_polars_df
or arrow:::as_adq
.
In any case, I don't think this is the issue here, so I'll close it.
I don't know if this can be called a bug, but I seem to get a strange error when I pass
arrow::Table
to thedata
argument.Created on 2024-02-27 with reprex v2.0.2
Perhaps this is related to the fact that columns can be accessed by
$
in the environment of thearrow::Table
object?In any case, I thought it might work better with objects like data frames by having
as.data.frame()
run first in thetinyplot
function.