R/wp_check_page_input.R

Defines functions wp_check_page_input

Documented in wp_check_page_input

#' check page input 
#'
#' @param page the pages to check
#' 
wp_check_page_input <- function(page){
  # make first letter capital
  page <- stringr::str_replace( page, "^.", substring(toupper(page),1,1) )
  
  # replace spaces with underscore
  page <- stringr::str_replace( page, " ", "_" )
  
  # url encode thos not already encoded
  for( i in seq_along(page) ){
    if ( stringr::str_detect( page[i], "%" ) ){
      page[i] <- utils::URLdecode(page[i])
    }
  }
  
  # return
  return(page)
}

Try the wikipediatrend package in your browser

Any scripts or data that you put into this service are public.

wikipediatrend documentation built on July 8, 2020, 5:44 p.m.