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

Dataframe subsetting fixes #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

emmaSkarstein
Copy link

The changes are made in order to allow users to enter data as tibbles as well as data frames.

In short, the problem is the fact that subsetting tibbles and data frames is different, so when you have a data frame df then df[,"colname"] will return a vector, but if you instead have a tibble tb, then tb[, "colname"] will return a tibble, not a vector! However, using instead df[["colname"]] and tb[["colname"]] will both give a vector, regardless of the object being a data frame or a tibble.

Originally I changed all cases of df[,"colname"] to df[["colname"]], but this seemed to cause an error, so I went back to only changing the subsetting where we check "is.logical(observs@data[,presname])". This means that the data frame subsetting is inconsistent throughout the function, though.

…o avoid problems when subsetting tibbles (without changing behavior for regular data frames).
Changed back subsetting all places except where we check class of observs@data[[presname]], as previous changes seemed to cause one error when running the tests. Now I think we will avoid the problems with tibbles, but this also means that the dataframe subsetting is inconsistent throughout the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant