Reputation: 411
I am trying to deal with some characters.
The code looks like this:
library(tidyr)
unite(data ,sep="%in% ")
Here data
is a data frame, which looks like this:
A B
1 Var 'Y'
I can run it successfully under R 3.4.4.
1 Var%in% 'Y'
But in R 3.5.1, it will tell me the error:
Error in is_string(expr) : argument "expr" is missing, with no default
How to solve this problem?
Sorry for not specifying the problem before. I have now figured it out what the problem is.
Upvotes: 1
Views: 2427
Reputation: 44957
You need to specify a name for the new column, e.g.
unite(data, "newcol", sep = "%in%")
This would appear to work without 3 arguments if you use a pipe, e.g.
data %>% unite("newcol", sep = "%in%")
but the pipe operator is really just hiding the fact that data
is the first argument.
Edited to add: Your original form did work in tidyr
version 0.8.1 (as pointed out by @Spacedman), but the dataframe it produced was invalid. This bug was fixed sometime after that.
Upvotes: 4