Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init - data arg - Are we planning to keep supporting a "list of objects"? Note that they don't have to be either data.frame or MAE any more. #1031

Closed
pawelru opened this issue Jan 9, 2024 · 6 comments
Assignees
Labels

Comments

@pawelru
Copy link
Contributor

pawelru commented Jan 9, 2024

          Are we planning to keep supporting a "list of objects"? Note that they don't have to be either `data.frame` or `MAE` any more.

Originally posted by @chlebowa in #1008 (comment)

@chlebowa
Copy link
Contributor

Note that vignettes have been widely approved that state:

All applications use the teal_data class as a data container. (Including Data in teal Applications)

@chlebowa chlebowa added the core label Jan 12, 2024
@donyunardi donyunardi mentioned this issue Jan 12, 2024
36 tasks
@vedhav
Copy link
Contributor

vedhav commented Jan 16, 2024

I don't see any real issue with us introducing this breaking change in this release.
teal_data can be used interchangeably with list which was not the case before when we had TealData classes. So, the need for list has vanished with this refactor and I don't see an older teal app that would work fine with the TealData -> teal_data refactor but relies on list to work, so it's broken anyway and this change is the easiest to adapt to.

@donyunardi
Copy link
Contributor

donyunardi commented Jan 17, 2024

I think I interpret the question the wrong way before I start reading the issue related to this. 🤦🏼

Here's what I understand:
This is the current assertion in init(data=):

teal/R/init.R

Lines 122 to 126 in 92301bc

checkmate::assert(
.var.name = "data",
checkmate::check_multi_class(data, c("teal_data", "teal_data_module")),
checkmate::check_list(data, names = "named")
)

So this won't work:
image

But this will work (making it a named list)
image

We prefer user to use teal_data() for the data argument so having this limitation (not allowing data to accept list of objects) feels okay to me. The hope is that user will be encouraged to learn about the teal_data object (and how to use it). Or, at the very least, follow the right convention by passing a named list object to simplify the conversion to teal_data object.

I guess we can remove/update the skipped test.

@gogonzo
Copy link
Contributor

gogonzo commented Jan 17, 2024

Historically, data = list(iris = iris) was a nice alternative to

teal_data(
  dataset("iris", iris)
)

and this is why we still keep accepting data as a named list. I think teal::init(data=) should only accept teal_data or teal_data_module, so that:

# accept this
init(data = teal_data(iris = iris), ...)

# instead of
init(data = list(iris = iris), ...)

teal_data call instead of list is still a one call vs one call.

@m7pr
Copy link
Contributor

m7pr commented Jan 17, 2024

I would go with possibility to pass only teal_data/teal_data_module so we have less ways of input, hence less to explain (in documentation, vignettes and presentations), in already complex framework. If it's limited, then we can make user spend more time thinking on other aspects of the framework, instead of making him/her figure out what's more accesible for him/hem when passing the data and what's the difference (which is not really important).

@chlebowa chlebowa self-assigned this Jan 17, 2024
@chlebowa
Copy link
Contributor

It seems we are in agreement.
#1051

chlebowa added a commit that referenced this issue Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants