Dataframe subsetting fixes #2
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.