0

I am using

library(haven)
library(expss)

These Two Packages to create Tables using R. I use the Following Syntax to create a New Variables

 df=compute(df, {
    recode (A1A,4:5~1,3~2,1:2~3) %into% a1
    })

It ran Properly there are no issue so far.

library(dplyr)
EDat <- EDat %>%
filter(TOPLINE == 1)

After I used dplyr Package i use the same syntax.

df=compute(df, {
recode (A1A,4:5~1,3~2,1:2~3) %into% Check
})

I cannot create the variable "Check" . Please help me on this.

user5249203
  • 4,436
  • 1
  • 19
  • 45
Divya
  • 47
  • 7
  • 2
    The function `recode` is part of expss package and as well as `dplyr` package. It is overriding name space. `dplyr::recode`, is how you want to call the function from dplyr namespace similar for `expss::recode` – user5249203 Dec 19 '18 at 14:11
  • 1
    for future [reference](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). When you post a Q on SO, try to get a reproducible example. If a user just copy paste your code in his Rsession, he should be able to reproduce the error you are getting. In this current stage of your Q, no one can reproduce the error. Update the missing info. – user5249203 Dec 19 '18 at 14:15
  • @Divya There is an alias for `recode` in the expss - `if_val`. So you can write `if_val(...) %into% a1`. Also you can use `where` from `expss` instead of `filter`: `where(TOPLINE==1)` and don't load dplyr. – Gregory Demin Dec 19 '18 at 15:28

0 Answers0