I have orders data with me with several columns. My task is mapping the orders which have extensions and storing it in new column "PPARENT_ID" column.
I have written the following code for mapping the orders.
library(purrr)
find_parent <- function(ID,`Extention of`){
if(is.null(`Extention of`)){
return(ID)
}else{
ptnt <- mis$`Extention of`[mis$ID==`Extention of`]
return(find_parent(`Extention of`,ptnt ))
}
}
mis$PPARENT_ID<- map2_chr(mis$ID, mis$`Extention of`, find_parent)
mis %>% select(PPARENT_ID)
when I run the mis %>% select(PPARENT_ID) command, it is throwing error as
"Error in FUN(X[[i]], ...) : object 'PPARENT_ID' not found"
please help me to resolve the issue.