So I'm trying to create a function which will take an argument from a list and return it into a dataframe. So far I got close with this sample code, but i've become stuck for a few weeks now.
# list of pets
pets = list("cats", "dogs")
# comment link
search_url = paste("https://duckduckgo.com/?q=", pets[])
# empty data frame for the pets
petsX <- data.frame()
# function for x in pets
getSearch <- function(x) {
  petsX <- ( search_url [x] )
}
getSearch(1)
# I want this to be:
# https://duckduckgo.com/?q=cats
Any help or guidance in the right direction would be truly appreciated.

