title: GTrendsR search Error in charToDate(x) when trying to for loop over search terms
body: <p>I've experienced an error on GTrendsR package which other examples on StackOverflow don't deal with, that is how to loop through several searches using for or lapply functionality. </p>
  
  <p>WHen I do sth simple like 
  gtrends(ch, query = "Harvard University" , geo = "US")</p>
  
  <p>I've gotten an error that doesn't occur with a do a simple search on one keyword.</p>
  
  <blockquote>
    <p>Error in charToDate(x) : 
      character string is not in a standard unambiguous format </p>
  </blockquote>
  
  <pre><code>from lapply(queries, function(x) gtrends(ch, query = x , geo = "US"))
  </code></pre>
  
  <p>and </p>
  
  <pre><code>for (i in seq_along(queries)) {
        x &lt;- queries[i]
        dta[i,] &lt;-  gtrends(ch, query = x , geo = "US")$trend   # trend data.frame returned from gtrends()
  }
  </code></pre>
  
  <p>In case background and code are needed: I'm trying to get Google Trends search history for US college names listed in IPEDS (at this <a href="https://inventory.data.gov/dataset/032e19b4-5a90-41dc-83ff-6e4cd234f565/resource/38625c3d-5388-4c16-a30f-d105432553a4/download/postscndryunivsrvy2013dirinfo.csv" rel="nofollow">US DofEd API link</a>)</p>
  
  <p>I'm using GTrendR package at </p>
  
  <pre><code>devtools::install_bitbucket(repo = "gtrendsr", username="persican")
  </code></pre>
  
  <p>Doing single search terms is fine. But as soon as I try to automate, I get GTrendsR error.</p>
  
  <pre><code>library("GTrendsR", lib.loc="~/Library/R/3.1/library")
  
  download.file("https://inventory.data.gov/dataset/032e19b4-5a90-41dc-83ff-6e4cd234f565/resource/38625c3d-5388-4c16-a30f-d105432553a4/download/postscndryunivsrvy2013dirinfo.csv" , destfile="ipeds.csv", method="curl")
  
  colleges &lt;- read.csv("./ipeds.csv", header=T, stringsAsFactors=F)
  
  queries &lt;- colleges$INSTNM  # Institution Names
  
  prepopulating dataframe with 3 columns from gtrends function
  
  dta &lt;-data.frame(matrix(NA, length(queries),3)) 
  </code></pre>
  
  <p>set credentials</p>
  
  <pre><code>usr &lt;- "your@gmail.com"
  psw &lt;- "yourpassword"
  ch &lt;- gconnect(usr, psw)
  </code></pre>
  
  <p>For loop to automate:</p>
  
  <pre><code>for (i in seq_along(queries)) {
        x &lt;- queries[i]
        dta[i,] &lt;-  gtrends(ch, query = x , geo = "US")$trend   # trend data.frame returned from gtrends()
  }
  </code></pre>
  
  <p>lapply doesn't work either:</p>
  
  <pre><code>lapply(queries, function(x) gtrends(ch, query = x , geo = "US")$trend)
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>Error in charToDate(x) : 
      character string is not in a standard unambiguous format </p>
  </blockquote>
  
  <p>The error seems to be due to dependency on a charToDate() I can't seem how to get to.</p>
  
  <p>However, when I use just 3 searches it works:</p>
  
  <pre><code>three &lt;- list("Harvard University", "Boston College", "Bard College")
  
  out &lt;- sapply(three, function(x)  cbind.data.frame(gtrends(ch, query = x , geo = "US")$trend[3])[])
  </code></pre>