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

collect() gives error on hidden variables even if editor of dataset #6

Closed
joewilliams-yg opened this issue Jul 12, 2018 · 1 comment

Comments

@joewilliams-yg
Copy link

Tried using ds %>% select(var, ...) %>% collect().
Documentation for collect() does not mention a work around

unlock(ds)
df <- ds %>%
select('identity', 'gender', 'age', 'age4', 'race4', 'educ4', 'presvote16x', 'e14_presvote12', 'pid3', 'ideo3', 'region', 'votereg2', 'app_dtrmp') %>%
collect() %>%
mutate(
race3 = recode_factor(race4, 'White' = 'White/Other', 'Other' = 'White/Other', 'Black'='Black', 'Hispanic'='Hispanic'),
educ3 = recode_factor(educ4, 'HS or less' = 'HS or less', 'Some college' = 'Some college', 'College grad' = 'College degree', 'Postgrad' = 'College degree'),
educ2 = recode_factor(educ3, 'HS or less' = 'No degree', 'Some college' = 'No degree', 'College degree' = 'College grad')
) %>%
rename(presvote12 = e14_presvote12) %>%
filter(complete.cases(.))

Ends up with this error:
Error: Unknown column identity

@nealrichardson
Copy link
Contributor

Likely this lapply: https://github.com/Crunch-io/crplyr/blob/master/R/collect.R#L27

is going through this method: https://github.com/Crunch-io/rcrunch/blob/master/R/dataset.R#L342

which does not include hidden variables.

Can't we now replace the guts of this collect method with as.data.frame.CrunchDataset? That didn't exist when the method was written, IIRC.

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

No branches or pull requests

3 participants