Skip to content

Instantly share code, notes, and snippets.

@jjesusfilho
Created May 25, 2017 01:03
Show Gist options
  • Save jjesusfilho/1972df11b77e86c1242905a7e580e5b1 to your computer and use it in GitHub Desktop.
Save jjesusfilho/1972df11b77e86c1242905a7e580e5b1 to your computer and use it in GitHub Desktop.
Extract query parameters from url
library(stringr)
library(magritr)
query_extract<-function(string){
s<-str_split(string,"&") %>%
unlist()
nomes<-s %>%
str_extract(".*?(?=\\=)")
valores<-s %>%
str_extract("(?<=\\=).*") %>%
as.list() %>%
`names<-`(nomes)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment