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

lead() issue: SET_STRING_ELT() must be a 'CHARSXP' not a 'language' #1588

Closed
josiekre opened this issue Dec 17, 2015 · 0 comments
Closed

lead() issue: SET_STRING_ELT() must be a 'CHARSXP' not a 'language' #1588

josiekre opened this issue Dec 17, 2015 · 0 comments

Comments

@josiekre
Copy link

@josiekre josiekre commented Dec 17, 2015

This issue only arises in the current development version (0.4.9 I believe). It does not in 0.4.3.

Here is a simplified example that reproduces the problem.

x <- data_frame(
    id = c(1, 1, 1, 2, 2, 2, 2, 3, 3), 
    o = c("Home", "Transfer", "Work", "Home", "Work", "Transfer", "Other", "Home", "Home"), 
    d = c("Transfer", "Work", "Home", "Work", "Transfer", "Other", "Home", "Transfer", "Other")
  ) %>%   
  group_by(id)

This is what x looks like

Source: local data frame [9 x 3]
Groups: id [3]

     id        o        d
  (dbl)    (chr)    (chr)
1     1     Home Transfer
2     1 Transfer     Work
3     1     Work     Home
4     2     Home     Work
5     2     Work Transfer
6     2 Transfer    Other
7     2    Other     Home
8     3     Home Transfer
9     3     Home    Other

Using lead() with mutate() results in this error:

> x %>% 
  mutate(d = ifelse(d == "Transfer" & lead(o == "Transfer"), lead(d), d)) %>% 
  filter(o != "Transfer")

Error in mutate_impl(.data, dots) : 
  Value of SET_STRING_ELT() must be a 'CHARSXP' not a 'language'
@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant