Hi all,
Below error message coming when I run below r code:
my r code here:
etr2018 <- "/etr_2018_exc_blanks.Rdata"
PeerCodeList <- c('Idv_Ocptn_Cd') # occupation field name
load(etr2018)
# Create the PeerCode by pasting together the columns from PeerCodeList
etr2018$PeerCode <- do.call(paste, c(select(etr2018, one_of(PeerCodeList)), sep="-"))
Error message:
Error in UseMethod("select_") :
no applicable method for 'select_' applied to an object of class "character"
Anyone can help me to resolve that error. Much appreciated your help to resolve that error.
Note: At the beginning I included following library
The error message is the key, no applicable method for 'select_' applied to an object of class "character" meaning you haven't created a data frame or tibble
Thanks so much for your tips!
It's working!
I've updated my code as follows:
etr_2018_exc_blanks$PeerCode <- do.call(paste, c(select(etr_2018_exc_blanks, one_of(PeerCodeList)), sep=""))
[here I used original dataset.]
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: