I have a filter()
function which filters for specific Regex in a tibble. Because I need to do this more than one time I want to write a as_mapper()
function to end up with shorter code. How can I do this?
I have tried the following :
adverts <- as_mapper(~!grepl("(xtm)|((k|K)(i|I|1|11)(d|D)(n|N).)|(Ar<e)\\s(you)\\s(in)|
(LOAN)|(AR(\\s|\\S)[0-9])|((B|b)(i|1|l)tc.)|(Coupon)|(Plastic.King)|(organs)|(SILI)|(Electric.Cigarette.Machine)",.$value,perl = T)%>% filter)
If I try to add this function to a tibble, R throws me a C stack usage x is too close to the limit
error. How can I avoid this?
One of the tibble which I want to check can be generated with the following code :
bribe <- read_html(paste("http://ipaidabribe.com/reports/paid?page", 10, sep = "="))
all.nodes <- c(".heading-3 a",".paid-amount span", ".date", ".location", ".transaction a")
test <- map(all.nodes, ~ html_nodes(bribe, .x) %>% html_text()) %>% unlist %>% as_tibble %>% adverts()