title: How do I search a list within a dataframe?
body: <p>I'm trying to locate specific terms in a data.frame. There are 7 columns with 1356 rows. The two columns that I'm interested in searching are list type. I would like to know where in either of the columns the word "hunter" appears.</p>
  
  <p>If I use <code>sapply</code> to check the types of data for each column I get the following:</p>
  
  <pre><code>sapply(dataframe, class)
  
           ID    pdf_name     keyword    page_num    line_num   line_text  token_text 
  "integer"    "factor" "character"   "integer"   "integer"      "list"      "list" 
  </code></pre>
  
  <p>When I try to filter out the rows in my data.frame that don't include my search term using </p>
  
  <pre><code>filter(dataframe, !grepl("hunt",token_text))
  </code></pre>
  
  <p>I get a print out of the whole data.frame. Ideally I would like to get a print out of just the rows where the search term appears in one of the lists. Here's 
  the <code>head</code> of what I get so far.</p>
  
  <pre><code>structure(list(ID = c(1L, 1L, 1L, 1L, 1L, 1L), pdf_name = structure(c(1L, 
  1L, 1L, 1L, 1L, 1L), .Label = c("Ames - 1994 - The Northwest Coast Complex Hunter-Gatherers, Eco.pdf", 
  "Byers and Broughton - 2004 - Holocene Environmental Change, Artiodactyl Abundan.pdf", 
  "Byers et al. - 2005 - Holocene artiodactyl population histories and larg.pdf", 
  "Clarkson and Bellas - 2014 - Mapping stone using GIS spatial modelling to pred.pdf", 
  "Codding and Jones - 2013 - Environmental productivity predicts migration, dem.pdf", 
  "Elston and Zeanah - 2002 - Thinking outside the box a new perspective on die.pdf", 
  "Elston et al. - 2014 - Living outside the box An updated perspective on .pdf", 
  "FinlaysonBillWa_2017_2ExpandingNotionsOfHu_TheDiversityOfHunterG.pdf", 
  "FinlaysonBillWa_2017_3ConceptualisingSubsi_TheDiversityOfHunterG.pdf", 
  "FinlaysonBillWa_2017_5OkhotskAndSushenHist_TheDiversityOfHunterG.pdf", 
  "FinlaysonBillWa_2017_6ComparativeAnalysisO_TheDiversityOfHunterG.pdf", 
  "FinlaysonBillWa_2017_7LetsStartWithOurAcad_TheDiversityOfHunterG.pdf", 
  "FinlaysonBillWa_2017_8ExperimentalEthnoarc_TheDiversityOfHunterG.pdf", 
  "Fowler et al. - 2013 - Archaeology in the Great Basin and Southwest Pap.pdf", 
  "Fulkerson - 2017 - Engendering the Past The Status of Gender and Fem.pdf", 
  "GowdyJohnM_1998_2WhatHuntersDoForALiv_LimitedWantsUnlimited.pdf", 
  "GowdyJohnM_1998_3SharingTalkingAndGiv_LimitedWantsUnlimited.pdf", 
  "GowdyJohnM_1998_5BeyondTheOriginalAff_LimitedWantsUnlimited.pdf", 
  "GowdyJohnM_1998_8TheFutureOfHunterGat_LimitedWantsUnlimited.pdf", 
  "Gray - 2011 - The Evolutionary Biology of Education How Our Hun.pdf", 
  "Grayson and Woolfenden - 2016 - Giant Sloths and Sabertooth Cats Archaeology of .pdf", 
  "GraysonDonaldKW_2016_ClovisCometsAndClimat_GiantSlothsAndSaberto.pdf", 
  "GraysonDonaldKW_2016_ExtinctMammalsDangero_GiantSlothsAndSaberto.pdf", 
  "Hildebrandt and McGuire - 2003 - Large-Game Hunting, Gender-Differentiated Work Org.pdf", 
  "Hockett - 1991 - Toward Distinguishing Human and Raptor Patterning .pdf", 
  "Hockett - 2005 - Middle and Late Holocene Hunting in the Great Basi.pdf", 
  "Hockett - 2010 - Back to Study Hall Further Reflections on Large G.pdf", 
  "Hockett et al. - 2013 - Large-scale trapping features from the Great Basin.pdf", 
  "Hockett et al. - 2014 - Identifying Dart and Arrow Points in The Great Bas.pdf", 
  "Janz - 2016 - Fragmented Landscapes and Economies of Abundance.pdf", 
  "Kintigh - 1997 - Thoughts on Writing in Archaeology With Special Re.pdf", 
  "LaBelle and Pelton - 2013 - Communal hunting along the Continental Divide of N.pdf", 
  "Lawson and Borgerhoff Mulder - 2016 - The offspring quantity-quality trade-off and human.pdf", 
  "Lemke - 2016 - Hunting Architecture and Foraging Lifeways beneath.pdf", 
  "Lew-Levy et al. - 2017 - How Do Hunter-Gatherer Children Learn Subsistence .pdf", 
  "Louderback et al. - 2011 - Middle-Holocene climates and human population dens.pdf", 
  "M. W. Lake - 2014 - Trends in Archaeological Simulation.pdf", 
  "Madsen and Simms - 1998 - The Fremont Complex A Behavioral Perspective.pdf", 
  "Margaret W. Conkey and Joan M. Gero - 1997 - Programme to Practice Gender and Feminism in Arch.pdf", 
  "Ross et al. - 2016 - Evidence for quantity–quality trade-offs, sex-spec.pdf", 
  "Silva et al. - 2014 - Historical ethnobotany an overview of selected st.pdf", 
  "Smith et al. - 2013 - Paleoindian technological provisioning strategies .pdf", 
  "Stirn - 2014 - Modeling site location patterns amongst late-prehi.pdf", 
  "Trigger - 1984 - Archaeology at the Crossroads What's New.pdf"
  ), class = "factor"), keyword = c("table", "table", "table", 
  "table", "table", "table"), page_num = c(2L, 2L, 2L, 3L, 3L, 
  3L), line_num = c(29L, 38L, 63L, 98L, 102L, 106L), line_text = list(
      "Salmon have advantages for foragers (72, 111); they occur at predictable times, in predictable places, and in once prodigious numbers. ", 
      "Such variation in clumping is not predictable. ", "People inevitably began taking advantage of the rich, predictable resource. ", 
      "Matson reasons that intensification, sedentism, and ownership of resource patches evolved among hunter-gatherers when the resources were sufficiently abundant, reliable, predictable, and limited geographically and temporally. ", 
      "Matson holds that intensification, inequality, and sedentism each flow as inevitable consequences of the stmcture of the resource base, but only intensification and status differentials are causally linked. ", 
      "Matson's view is that Northwest Coast societies would only develop in an environment that was reliably rich and predictable. "), 
      token_text = list(list(c("salmon", "have", "advantages", 
      "for", "foragers", "72", "111", "they", "occur", "at", "predictable", 
      "times", "in", "predictable", "places", "and", "in", "once", 
      "prodigious", "numbers")), list(c("such", "variation", "in", 
      "clumping", "is", "not", "predictable")), list(c("people", 
      "inevitably", "began", "taking", "advantage", "of", "the", 
      "rich", "predictable", "resource")), list(c("matson", "reasons", 
      "that", "intensification", "sedentism", "and", "ownership", 
      "of", "resource", "patches", "evolved", "among", "hunter", 
      "gatherers", "when", "the", "resources", "were", "sufficiently", 
      "abundant", "reliable", "predictable", "and", "limited", 
      "geographically", "and", "temporally")), list(c("matson", 
      "holds", "that", "intensification", "inequality", "and", 
      "sedentism", "each", "flow", "as", "inevitable", "consequences", 
      "of", "the", "stmcture", "of", "the", "resource", "base", 
      "but", "only", "intensification", "and", "status", "differentials", 
      "are", "causally", "linked")), list(c("matson's", "view", 
      "is", "that", "northwest", "coast", "societies", "would", 
      "only", "develop", "in", "an", "environment", "that", "was", 
      "reliably", "rich", "and", "predictable")))), row.names = c(NA, 
  6L), class = "data.frame")
  </code></pre>